RigidBody Class
Represents a rigid body
Constructor
RigidBody
-
shape
-
mass
Parameters:
-
shape
Object -
mass
Number
Item Index
Methods
Methods
applyForce
-
force
Adds a force to the rigid_body which will be used only for the next integration
Parameters:
-
force
Vec3force to apply to the rigid_body
applyForceAtLocalPoint
-
force
-
point
Applies vector force
to body at position point
in body's frame
Parameters:
-
force
Vec3Force to apply
-
point
Vec3local frame coordinates where force originates
applyForceAtWorldPoint
-
force
-
point
Applies the vector force
at world coordinate point
Parameters:
-
force
Vec3Force to apply
-
point
Vec3world coordinates where force originates
applyImpulse
-
impulse
Directly adds linear velocity to the body
Parameters:
-
impulse
Vec3linear velocity to add to the body
findSupportPoint
-
direction
-
support_point
Given direction
, find the point in this body which is the most extreme in that direction.
This support point is calculated in world coordinates and stored in the second parameter support_point
Parameters:
-
direction
Vec3direction to use in finding the support point
-
support_point
Vec3vec3 variable which will contain the supporting point after calling this method
integrate
-
timestep
Updates the rigid body's position, velocity, and acceleration
Parameters:
-
timestep
Numbertime, in seconds, to use in integration
setGravity
-
x
-
y
-
z
Sets a custom gravity value for this rigid_body
Parameters:
-
x
Numbergravity to apply on x axis
-
y
Numbergravity to apply on y axis
-
z
Numbergravity to apply on z axis
updateDerived
()
Sets the rigid body's transformation matrix to the current position and rotation
Properties
acceleration
Vec3
the rigid body's current acceleration
Default: [ 0, 0, 0 ]
accumulated_force
Vec3
private
All resultant torque accumulated by the rigid body this torque is applied in the next occurring integration
Default: [ 0, 0, 0 ]
accumulated_force
Vec3
private
all resultant force accumulated by the rigid body this force is applied in the next occurring integration
Default: [ 0, 0, 0 ]
angular_damping
Number
proportion of angular velocity lost per second ( 0.0 - 1.0 )
angular_velocity
Vec3
the rigid body's current angular velocity
Default: [ 0, 0, 0 ]
friction
Number
amount of friction this object has
Default: 0.5
gravity
Vec3
private
the rigid body's custom gravity
Default: null
id
Number
goblin ID of the body
intersection_list {Array} array to append intersection to
Vec3
Checks if a ray segment intersects with the object
linear_damping
Number
proportion of linear velocity lost per second ( 0.0 - 1.0 )
linear_velocity
Vec3
the rigid body's current linear velocity
Default: [ 0, 0, 0 ]
mass
Number
the rigid body's mass
Default: Infinity
position
Vec3
the rigid body's current position
Default: [ 0, 0, 0 ]
restitution
Number
amount of restitution this object has
Default: 0.1
shape
Unknown
shape definition for this rigid body
transform
Mat4
transformation matrix transforming points from object space to world space
transform_inverse
Mat4
transformation matrix transforming points from world space to object space
world
Goblin.World
the world to which the rigid body has been added, this is set when the rigid body is added to a world
Default: null