Class: Rigidbody

Components.Rigidbody

rigidbody component class.

new Components.Rigidbody (owner)

Name Type Description
owner Core.Entity the entity the component's being applied to.

Members

Components.Rigidbody.component_name String static

the component name

Methods

applyAcceleration (acceleration)

applys acceleration to the rigidbody over the tick
Name Type Description
acceleration Utils.Vector2d the acceleration vector

applyVelocity (velocity)

applys velocity to the rigidbody
Name Type Description
velocity Utils.Vector2d the velocity to add over the tick

calcCollision (other, normal)

resolve collision between this and other rigidbody
Name Type Description
other Components.Rigidbody other rigidbody (that collides with this one)
normal Utils.Vector2d collision normal

fixPenetration (other, penVec)

fixes bodies penetration/energy loss
Name Type Description
other Components.Rigidbody other rigidbody (that collides with this one)
penVec Utils.Vector2d penetration vector of the two rigidbodies

setParent (p)

sets parent (attches component to entity p)
Name Type Description
p Core.Entity entity to attach to (should be parent; parent can be object)

setStaticBody ()

sets rigidbody as static (infinite mass, does not move)

tick_update ()

actual update function (tick)

update ()

auto-only updates rigidbody (tick)