The purpose of this example is to demonstrate the EPhysics Force usage -\/ The code applies force over two cubes.

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


For this example we\textquotesingle{}ll have an EPhysics\+\_\+\+World with gravity setted to zero, 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 \mbox{\hyperlink{tutorial_ephysics_bouncing_ball}{EPhysics -\/ Bouncing Ball}}\hypertarget{tutorial_ephysics_forces_add-force}{}\doxysection{Adding a Force}\label{tutorial_ephysics_forces_add-force}


We apply a force over the first body to change its linear and angular accelerations. Applying a force to a body will lead it to change its velocity gradually.

Note that in this blue cube we use an offset to apply the force, the two last parameters are responsible to set a relative position to apply the force.\+In other words, the force applied with an offset will make the body rotates. Otherwise (0, 0, 0) the force would be applied on the center of the body, in this case its recommended use the \mbox{\hyperlink{group__EPhysics__Body_ga2134702db807dc4f7dc604d72e5b73db}{ephysics\+\_\+body\+\_\+central\+\_\+force\+\_\+apply()}};


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_ga5fe14931bd89326182bdf021d84ec40c}{ephysics\_body\_force\_apply}}(box\_body1,\ 60,\ 0,\ 0,\ 0,\ 10,\ 0);}

\end{DoxyCodeInclude}
 Here we apply a central force over the second body avoiding affect the angular acceleration (rotate).


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_ga2134702db807dc4f7dc604d72e5b73db}{ephysics\_body\_central\_force\_apply}}(box\_body2,\ 60,\ 0,\ 0);}

\end{DoxyCodeInclude}
 We can also get all the forces applied over a body, including gravity, but in this case we setted to zero.




\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_gaa4ff8dc0e1edefd2ad6a52361ff23edd}{ephysics\_body\_forces\_get}}(body,\ \&x,\ \&y,\ \&z);}

\end{DoxyCodeInclude}
 Here we finish the example. The full source code can be found at \mbox{\hyperlink{test_forces_c}{test\+\_\+forces.\+c}}. 