Movable Class
A component class which holds variables related to the dynamics of an entity.
Constructor
Movable
-
mass
-
dragCoefficient
-
fastObject
-
initialVelocityX
-
initialVelocityY
Parameters:
-
mass
Number -
dragCoefficient
Number -
fastObject
BooleanSpecifies whether the object is fast or not. A fast object gets updated multiple times per frame which should prevent it from passing through other objects.
-
initialVelocityX
NumberThe x component of the initial velocity vector.
-
initialVelocityY
NumberThe y component of the initial velocity vector.
Item Index
Methods
applyImpulse
-
impulse
Parameters:
-
impulse
Vector2DVector representing the impulse to be applied.
clearForces
()
Clears all forces that were applied to the component between now and the last physics system update.
clearImpulses
()
Clears all impulses that were applied to the component between now and the last physics system update.
getDragCoefficient
()
Number
Returns:
getFastObject
()
Boolean
Returns:
getMass
()
Number
Returns:
setDragCoefficient
-
dragCoefficient
Parameters:
-
dragCoefficient
Number
setFastObject
-
fastObject
Sets whether the object is fast or not. A fast object gets updated multiple times per frame which should prevent it from passing through other objects.
Parameters:
-
fastObject
Boolean
setMass
-
mass
Parameters:
-
mass
NumberMass needs to be a positive number. For infinite masses use Number.POSITIVE_INFINITY.
setVelocity
-
x
-
y
Parameters:
-
x
NumberThe x component of the new velocity.
-
y
NumberThe y component of the new velocity.