RigidBody Class
Represents a rigid body
Constructor
RigidBody
-
shape -
mass
Parameters:
-
shapeObject -
massNumber
Item Index
Methods
Methods
applyForce
-
force
Adds a force to the rigid_body which will be used only for the next integration
Parameters:
-
forceVec3force to apply to the rigid_body
applyForceAtLocalPoint
-
force -
point
Applies vector force to body at position point in body's frame
Parameters:
-
forceVec3Force to apply
-
pointVec3local frame coordinates where force originates
applyForceAtWorldPoint
-
force -
point
Applies the vector force at world coordinate point
Parameters:
-
forceVec3Force to apply
-
pointVec3world coordinates where force originates
applyImpulse
-
impulse
Directly adds linear velocity to the body
Parameters:
-
impulseVec3linear 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:
-
directionVec3direction to use in finding the support point
-
support_pointVec3vec3 variable which will contain the supporting point after calling this method
integrate
-
timestep
Updates the rigid body's position, velocity, and acceleration
Parameters:
-
timestepNumbertime, in seconds, to use in integration
setGravity
-
x -
y -
z
Sets a custom gravity value for this rigid_body
Parameters:
-
xNumbergravity to apply on x axis
-
yNumbergravity to apply on y axis
-
zNumbergravity 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
