\chapter{EPhysics -\/ Gravity}
\hypertarget{tutorial_ephysics_gravity}{}\label{tutorial_ephysics_gravity}\index{EPhysics -\/ Gravity@{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.

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth,height=\textheight/2,keepaspectratio=true]{no_gravity}}
\end{DoxyImageNoCaption}


For this example we\textquotesingle{}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 \doxysectlink{tutorial_ephysics_bouncing_ball}{EPhysics -\/ Bouncing Ball}{0}

Concepts like velocity and sleeping threshold were already covered in\+: \begin{DoxyItemize}
\item \doxysectlink{tutorial_ephysics_velocity}{EPhysics -\/ Velocity}{0} \item \doxysectlink{tutorial_ephysics_sleeping_threshold}{EPhysics -\/ Sleeping Threshold}{0}\end{DoxyItemize}
\hypertarget{tutorial_ephysics_gravity_add-gravity}{}\doxysection{\texorpdfstring{Setting Gravity}{Setting Gravity}}\label{tutorial_ephysics_gravity_add-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.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__World_ga849f9d794ce5da7bf07f0bfc71aa5b6c}{ephysics\_world\_gravity\_set}}(world,\ 0,\ 0,\ 0);}

\end{DoxyCodeInclude}
 \hypertarget{tutorial_ephysics_gravity_add-stopbody}{}\doxysection{\texorpdfstring{Stopping a Body}{Stopping a Body}}\label{tutorial_ephysics_gravity_add-stopbody}


We\textquotesingle{}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.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\_stop(\textcolor{keywordtype}{void}\ *data,\ Evas\_Object\ *obj\ \_\_UNUSED\_\_,\ \textcolor{keywordtype}{void}\ *event\_info\ \_\_UNUSED\_\_)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Test\_Data\ *test\_data\ =\ data;}
\DoxyCodeLine{\ \ \ EPhysics\_Body\ *body\ =\ test\_data-\/>data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_gabf7fbfc0052b28ed1d5fcade8eeaa5e6}{ephysics\_body\_stop}}(body);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Here we finish the example. The full source code can be found at \doxysectlink{test_no_gravity_c}{test\+\_\+no\+\_\+gravity.\+c}{0}. 