Common Actions and Expressions
Physical Movements Common Actions and Expressions
Common Action Menu
Every object that contains a physics movement has access to a set of new actions, contained in the Movement / Physics submenu.
- Set gravity
Although it is not contained in the physics sub-menu, the set gravity action can be used to change the gravity scale of the object in the world. Its parameter is a percentage of the world's gravity to apply to the object. 100 will take the world gravity exactly. 500 will multiply it by 5. -100 will make it a reverse gravity.
- Set elasticity
Changes the elasticity of the object. An object with an elasticity of 100 will bounce on other objects, and stop with a value of 0.
- Set friction
Changes the friction parameter of the object. An object with a friction of 0 will slide on the other object, an object with a friction of 100 will stick to the other objects.
- Set density
For technical reasons, this action has been moved to the Physics - Engine action menu, in the "Object" section.
- Apply impulse
This action applies a brief impulse to the object. The object will start to move in the direction of the impulse. The resulting speed will depend on the size and density of the object (heavier objects will move less).
Parameters : force of the impulse, from 0 to 250, and angle of the impulse, in degrees from 0 to 360.
- Apply angular impulse
This action applies a torque for a brief period of time, making the object turn in the direction of the torque. The parameter is the torque, a value from -250 (clockwise) to 250 (anti clockwise). Values like 10 or 20 are usually preferred.
- Apply force
This action continuously applies a force to the object, making it accelerate in the direction of the force. Parameters : strength of the force, from 0 to 250, and angle in degrees from 0 to 360.
- Stop force
Stops a force that has been applied to the object with the previous action.
- Apply torque
This action continuously applies a torque to the object, making it turn faster and faster in the direction of the torque. Parameter: torque, from -250 (clockwise) to 250 (anti-clockwise).
- Stop torque
This action stops the torque that was applied to the object by the previous action.
- Set linear velocity
This action forces the speed of the object. Parameters: speed (from 0 to 250) and angle (in degrees, from 0 to 360).
- Set angular velocity
This action forces the rotation speed of the object. Parameter: rotation speed, from -250 to 250.
Common Expression Menu
Every object that contains a physics movement has access to a set of new expressions, contained in the Movement / Physics submenu.
This expression is not located in the Physics sub-menu. It returns the gravity scale of the object. A value of 0 means no gravity, a value of 100 is 100% of the world's gravity.
Returns the density of the object, a value from 0 to 100.
Returns the friction of the object, a value from 0 to 100.
Returns the elasticity of the object, a value from 0 to 100.
Returns the velocity of the object. This value may be slighly different from the value returned by the speed expression as it is the value of the velocity taken directly from Box2D.
Returns the angle of the Box2D object. Here too, the value maybe different from the value returned by the "Angle" expression.
Spread the word!
You can share this document using the following buttons.