EPhysics - Gravity

The purpose of this example is to demonstrate the EPhysics Gravity usage - The code apply gravity in an EPhysics_World with two cubes in movement.

For this example we'll have an EPhysics_World, and two basic EPhysics_Bodys.

The basic concepts like - defining an EPhysics_World, render geometry, physics limiting boundaries, add an EPhysics_Body, associate it to evas objects, change restitution, friction and impulse properties, were already covered in EPhysics - Bouncing Ball

Concepts like velocity and sleeping threshold were already covered in:

- EPhysics - Velocity
- EPhysics - Sleeping Threshold

# Setting Gravity

Here we set gravity on 3 axes (x, y, z) to (0, 0, 0). Gravity will act over bodies with mass over all the time.

ephysics_world_gravity_set(world, 0, 0, 0);
ephysics_world_gravity_set
EAPI void ephysics_world_gravity_set(EPhysics_World *world, double gx, double gy, double gz)
Set world gravity in the 3 axes (x, y, z).

# Stopping a Body

We're using a button to call this function that receives test_data to stop the chosen body.

Stop angular and linear body movement, its equivalent to set linear velocity to 0 on both axis and angular velocity to 0 as well.

_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Test_Data *test_data = data;
EPhysics_Body *body = test_data->data;
ephysics_body_stop(body);
ephysics_body_stop
EAPI void ephysics_body_stop(EPhysics_Body *body)
Stop angular and linear body movement.
EPhysics_Body
struct _EPhysics_Body EPhysics_Body
Body handle, represents an object on EPhysics world.
Definition EPhysics.h:655
Evas_Object
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition Evas_Common.h:185
}

Here we finish the example. The full source code can be found at test_no_gravity.c.