Ethanon Engine uses Box2D for physics simulation. Enabling physics simulation on entities is easy, all you need to do is enable Collidable in the Entity Editor and then choose the body shape in the Physics properties:
Ethanon engine will take the Collision box relative Position and Size to scale Box2D's collision body.
Enabling a physics-managed body to an entity will transfer control over the entity position and angle to the physics engine. It means that, internally, a Box2D's body (
b2Body) is created and its simulation begins as soon as the entity is added to scene. Read the "Bodies" section in the Box2D User Manual to learn more about how bodies work.
Circle body diameter will be computed as
(Box.size.x + Box.size.y) / 2.
Highlighted properties are described below.
Floating point values:
1.0. Dynamic entities must have density greater than
0.0to behave properly
0.0means completely slippery and
1.0produces more friction than a crude piece of rock (just an example)
0.0means no bouncing at all and
1.0means full force bouncing, which usually can't be seen in nature
Ethanon engine offers several functions that may be used to control physics simulation global states.
Physics-simulated Static entities won't be affected by the force or gravity and it won't react to impulses and collisions. Setting an entity as Static is useful to create static platforms on side scrolling adventure games.
The Box2D User Manual states that "A static body does not move under simulation and behaves as if it has infinite mass. Internally, Box2D stores zero for the mass and the inverse mass. Static bodies can be moved manually by the user. A static body has zero velocity. Static bodies do not collide with other static bodies."
Entitiy-bodies are automatically assigned as dynamic or static according to its entity state.