The purpose of this example is to demonstrate the E\+Physics Sleeping Threshold usage -\/ The code apply sleeping threshold in two cubes.

For this example we'll have an E\+Physics\+\_\+\+World, and two basic E\+Physics\+\_\+\+Bodys.

The basic concepts like -\/ defining an E\+Physics\+\_\+\+World, render geometry, physics limiting boundaries, add an E\+Physics\+\_\+\+Body, associate it to evas objects, change restitution, friction and impulse properties, were already covered in \hyperlink{tutorial_ephysics_bouncing_ball}{E\+Physics -\/ Bouncing Ball}

Concept of velocity were already covered in \hyperlink{tutorial_ephysics_velocity}{E\+Physics -\/ Velocity}\hypertarget{tutorial_ephysics_sleeping_threshold_add-maxsleeping}{}\section{Adding Max Sleeping Time}\label{tutorial_ephysics_sleeping_threshold_add-maxsleeping}


Setting the max sleeping time determines how long(in seconds) a rigid body under the linear and angular threshold is supposed to be marked as sleeping.


\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__World_ga797b98c12273d85f7dd5b30a911f76f2}{ephysics\_world\_max\_sleeping\_time\_set}(world, 0.3);

\end{DoxyCodeInclude}
\hypertarget{tutorial_ephysics_sleeping_threshold_add-sleeping}{}\section{Adding a Sleeping Threshold}\label{tutorial_ephysics_sleeping_threshold_add-sleeping}


Here we set E\+Physics\+\_\+\+Bodys linear and angular sleeping threshold. These factors are used to determine whenever a rigid body is supposed to increment the sleeping time.

After every tick the sleeping time is incremented. After reaching the max sleeping time the body is market to sleep, that means the rigid body is to be deactivated.


\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_gaa65f3bf819cf09ac5da543ee6460a9f3}{ephysics\_body\_sleeping\_threshold\_set}(sphere\_body1, 60, 360);

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_gaa65f3bf819cf09ac5da543ee6460a9f3}{ephysics\_body\_sleeping\_threshold\_set}(sphere\_body2, 10, 360);

\end{DoxyCodeInclude}


We can get the E\+Physics\+\_\+\+Bodys linear and angular sleeping threshold as well.


\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_gacaf8c1fdcc247819ef0646539742c11b}{ephysics\_body\_sleeping\_threshold\_get}(sphere\_body1, &linear, &angular
      );

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_gacaf8c1fdcc247819ef0646539742c11b}{ephysics\_body\_sleeping\_threshold\_get}(sphere\_body2, &linear, &angular
      );

\end{DoxyCodeInclude}
\hypertarget{tutorial_ephysics_sleeping_threshold_add-damping}{}\section{Adding a Damping}\label{tutorial_ephysics_sleeping_threshold_add-damping}


Here we set E\+Physics\+\_\+\+Bodys linear and angular damping values.\+The damping is a force synchronous with the velocity of the object but in opposite direction -\/ like air resistence.


\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_ga0ecea96f6a5a62f29e2bdeecb86db400}{ephysics\_body\_damping\_set}(sphere\_body1, 0.5, 0.5);

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Body_ga0ecea96f6a5a62f29e2bdeecb86db400}{ephysics\_body\_damping\_set}(sphere\_body2, 0.5, 0.5);

\end{DoxyCodeInclude}


Here we finish the example. The full source code can be found at \hyperlink{test_sleeping_threshold_c}{test\+\_\+sleeping\+\_\+threshold.\+c}. 