Actors > Motion

Speed

Get Speed Returns the current [X / Y] speed for the actor.

[ACTOR].getXVelocity()
[ACTOR].getYVelocity()

Set Speed Sets the [X / Y] speed for the actor.

[ACTOR].setXVelocity([NUMBER]);
[ACTOR].setYVelocity([NUMBER]);

Set Velocity (given Direction and Speed) Sets the actor's velocity, given a direction and a magnitude (speed) rather than X/Y components like above.

[ACTOR].setVelocity([NUMBER], [NUMBER]);

Force

Push (given X/Y) Pushes (or shoves) an actor, given an X/Y direction and force. Shoving is more "forceful" than pushing - experiment and see which works better for you.

[ACTOR].push([NUMBER], [NUMBER], [NUMBER]);
[ACTOR].applyImpulse([NUMBER], [NUMBER], [NUMBER]);

Push (given Angle) Pushes (or shoves) an actor, given an angle and force. Shoving is more "forceful" than pushing - experiment and see which works better for you.

[ACTOR].pushInDirection([NUMBER], [NUMBER]);
[ACTOR].applyImpulseInDirection([NUMBER], [NUMBER]);

Twist (rotate using force) Twists (applies torque) to an actor, given a force.

Turning Speed

Get Turning Speed Returns the turning speed (angular velocity) of the actor (in degrees).

Utils.DEG * ([ACTOR].getAngularVelocity())

Set Turning Speed Sets the turning speed (angular velocity) of the actor (in degrees). Positive turns clockwise. Negative turns counter-clockwise.

Physics

Toggle Gravity Enables or disables gravity for this actor.

[ACTOR].setIgnoreGravity(false); //enable gravity
[ACTOR].setIgnoreGravity(true); //disable gravity

Toggle Rotation Enables or disableds rotation for this actor.

[ACTOR].enableRotation();
[ACTOR].disableRotation();

Set Friction / Bounciness Sets the actor's friction and bounciness settings. Provide a value between [0.0 - 1.0] inclusive.

Read our Physics guide for an explanation of what these fields mean.

[ACTOR].setFriction([NUMBER]);
[ACTOR].setBounciness([NUMBER]);
[ACTOR].setMass([NUMBER]);
[ACTOR].setAngularMass([NUMBER]);
[ACTOR].setLinearDamping([NUMBER]);
[ACTOR].setAngularDamping([NUMBER]);

Get Friction / Bounciness Gets the actor's friction and bounciness settings. Read our Physics guide for an explanation of what these fields mean.

[ACTOR].getFriction()
[ACTOR].getBounciness()
[ACTOR].getMass()
[ACTOR].getAngularMass()
[ACTOR].getLinearDamping()
[ACTOR].getAngularDamping()