class
Eagle::Physics3D::Body
- Eagle::Physics3D::Body
- Reference
- Object
Overview
A 3D physics body: position, rotation, velocities, mass and shapes. Physics nodes create them for you.
Defined in:
eagle/physics/physics3d.crConstructors
-
.new(type : BodyType = BodyType::Dynamic, position : Vec3 = Vec3::ZERO, shape : Shape | Nil = nil)
Creates a body, optionally with a first shape.
Instance Method Summary
-
#aabb : AABB
World-space bounds.
-
#add_shape(s : Shape) : Shape
Adds a shape and recomputes mass.
-
#angular_damping : Float32
Drag on spin.
-
#angular_damping=(angular_damping : Float32)
Drag on spin.
-
#angular_velocity : Vec3
Spin axis scaled by radians per second.
-
#angular_velocity=(angular_velocity : Vec3)
Spin axis scaled by radians per second.
-
#apply_force(f : Vec3, point : Vec3 | Nil = nil) : Nil
Adds a force for the next step, at point if given.
-
#apply_impulse(i : Vec3, point : Vec3 | Nil = nil) : Nil
Changes velocity instantly, at point if given.
-
#apply_torque(t : Vec3) : Nil
Adds torque for the next step.
-
#collides_with?(o : Body) : Bool
True when layer and mask bits allow a collision.
-
#contacts : Set(Eagle::Physics3D::Body)
Bodies touching this one after the last step.
-
#contains_point?(p : Vec3) : Bool
True when a world-space point is inside any shape.
-
#density : Float32
Mass per unit volume.
-
#density=(density : Float32)
Mass per unit volume.
-
#dynamic? : Bool
True for dynamic bodies.
-
#enabled=(enabled : Bool)
Disabled bodies are skipped.
-
#enabled? : Bool
Disabled bodies are skipped.
-
#fixed_rotation=(v : Bool)
Enables or disables rotation.
-
#fixed_rotation=(fixed_rotation : Bool)
Prevents rotation.
-
#fixed_rotation? : Bool
Prevents rotation.
-
#force : Vec3
Force accumulated for the next step.
-
#force=(force : Vec3)
Force accumulated for the next step.
-
#friction : Float32
Surface grip.
-
#friction=(friction : Float32)
Surface grip.
-
#gravity_scale : Float32
Multiplies gravity for this body.
-
#gravity_scale=(gravity_scale : Float32)
Multiplies gravity for this body.
-
#id : Int32
A unique id.
-
#inv_inertia_apply(v : Vec3) : Vec3
Applies the world-space inverse inertia to v.
-
#inv_inertia_local : Vec3
Inverse inertia in body space.
-
#inv_mass : Float32
1 / mass, or 0 for non-dynamic bodies.
-
#kinematic? : Bool
True for kinematic bodies.
-
#layer : UInt32
Layer bits.
-
#layer=(layer : UInt32)
Layer bits.
-
#linear_damping : Float32
Drag on linear velocity.
-
#linear_damping=(linear_damping : Float32)
Drag on linear velocity.
-
#mask : UInt32
Mask bits.
-
#mask=(mask : UInt32)
Mask bits.
-
#mass : Float32
Mass.
-
#mass=(m : Number)
Sets the mass directly.
-
#owner : Node | Nil
The node that owns this body, if any.
-
#owner=(owner : Node | Nil)
The node that owns this body, if any.
-
#position : Vec3
World-space position.
-
#position=(position : Vec3)
World-space position.
-
#restitution : Float32
Bounciness from 0 to 1.
-
#restitution=(restitution : Float32)
Bounciness from 0 to 1.
-
#rotation : Quat
Orientation.
-
#rotation=(rotation : Quat)
Orientation.
-
#sensor=(sensor : Bool)
Sensors report overlaps but don't collide.
-
#sensor? : Bool
Sensors report overlaps but don't collide.
-
#shapes : Array(Eagle::Physics3D::Shape)
Shapes in local space.
-
#static? : Bool
True for static bodies.
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
-
#torque : Vec3
Torque accumulated for the next step.
-
#torque=(torque : Vec3)
Torque accumulated for the next step.
-
#transform : Mat4
The body's transform.
-
#type : BodyType
Static, kinematic or dynamic.
-
#type=(t : BodyType)
Changes the body type.
-
#velocity : Vec3
Linear velocity in meters per second.
-
#velocity=(velocity : Vec3)
Linear velocity in meters per second.
-
#velocity_at(point : Vec3) : Vec3
Velocity of a world-space point on the body.
Constructor Detail
Creates a body, optionally with a first shape.
Instance Method Detail
Adds a force for the next step, at point if given.
Changes velocity instantly, at point if given.
Layer bits. See Physics2D::Body#layer for how layers and masks combine.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>