The purpose of this example is to demonstrate the E\+Physics Slider constraint usage -\/ The code applies slider on three cubes.

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics{slider}}
\end{DoxyImageNoCaption}


For this example we'll have an E\+Physics\+\_\+\+World, and four 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}

You can use also a P2\+P (point to point) constraint\+: \hyperlink{tutorial_ephysics_constraint}{E\+Physics -\/ Constraint}\hypertarget{tutorial_ephysics_slider_add-slider}{}\section{Adding a Slider}\label{tutorial_ephysics_slider_add-slider}


Slider is a constraint that will limit the linear and angular moving of a body.

We'll add three sliders on the cubes, starting with the highest purple.

First we need to create a specific variable type to get E\+Physics\+\_\+\+Body constraint and create a new slider constraint passing the body which we want as parameter.


\begin{DoxyCodeInclude}
   \hyperlink{group__EPhysics__Constraint_ga6cdc4a630836a63a51489b885c09c7e3}{EPhysics\_Constraint} *constraint;

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}


Here we define the linear moving limits of the slider constraint, in this case we just set moving limit down on Y axis (under), but if we wanted we could set left, right and above also.


\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}


Here we set the angular moving limits of the slider constraint. The angular moving limits is defined in degrees and will limit the moving on Z axis, in this case we just set the clockwise direction, but if we wanted we could set the counter clockwise direction also.


\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}


When this cube falls by the gravity, the slider constraint will act limiting its linear and angular movings, giving the impression that its hanging.

For the next two cubes is the same process.

Now we set the slider constraint of the highest blue and lowest purple, limiting moving limits to the left on X axis and applying an impulse to the left where the two cubes will be limited by the slider constraint and pushed back.


\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}



\begin{DoxyCodeInclude}

\end{DoxyCodeInclude}


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