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

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 \mbox{\hyperlink{tutorial_ephysics_bouncing_ball}{EPhysics -\/ Bouncing Ball}}

Concept of velocity were already covered in \mbox{\hyperlink{tutorial_ephysics_velocity}{EPhysics -\/ Velocity}}\hypertarget{tutorial_ephysics_sleeping_threshold_add-maxsleeping}{}\doxysection{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}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__World_ga797b98c12273d85f7dd5b30a911f76f2}{ephysics\_world\_max\_sleeping\_time\_set}}(world,\ 0.3);}

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


Here we set EPhysics\+\_\+\+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}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_gaa65f3bf819cf09ac5da543ee6460a9f3}{ephysics\_body\_sleeping\_threshold\_set}}(sphere\_body1,\ 60,\ 360);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_gaa65f3bf819cf09ac5da543ee6460a9f3}{ephysics\_body\_sleeping\_threshold\_set}}(sphere\_body2,\ 10,\ 360);}

\end{DoxyCodeInclude}
 We can get the EPhysics\+\_\+\+Bodys linear and angular sleeping threshold as well.


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

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


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


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__EPhysics__Body_ga0ecea96f6a5a62f29e2bdeecb86db400}{ephysics\_body\_damping\_set}}(sphere\_body1,\ 0.5,\ 0.5);}
\DoxyCodeLine{\ \ \ \mbox{\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 \mbox{\hyperlink{test_sleeping_threshold_c}{test\+\_\+sleeping\+\_\+threshold.\+c}}. 