## HELP! Cannot understand NewtonSliderGetJointPosit

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

### HELP! Cannot understand NewtonSliderGetJointPosit

This image is only to illustrate.

I'm storing the value obtained from this function into a variable, but I cannot understand what it is returning to me. When I make the wheel spin (but not move), slowly, the values returned are:
...
dist = 1.488562
dist = 2.690776
dist = 2.684572
dist = 2.699624
...
dist = 2.699119
dist = 2.705326
dist = 0.332537

I cannot find any logic on them, what it jumps, suddenly, from 1.488562 to 2.690776 and then jumps again from 2.705326 to 0.332537.? Any help will be VERY appreciated.
Developing a racing game.

Posts: 132
Joined: Sat May 17, 2008 9:17 am

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

are you using the beta?
Is this a joint for teh card joint, a custon joint, or the build in joint.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

Yes, I'm using the 2.0 Beta.

I'm creating a common slider, NewtonCreateSlider.
Developing a racing game.

Posts: 132
Joined: Sat May 17, 2008 9:17 am

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

first make sure you have laters.
secund I would use the custon slider instead, is is opens source and you can see how the position is calculated.
basically you can derive you joint form teh custom slider and add this funtions

Code: Select all
`float CustomSlider::CalculatePosition (){   dMatrix matrix0;   dMatrix matrix1;   // calculate the position of the pivot point and the Jacobian direction vectors, in global space.    CalculateGlobalMatrix (m_localMatrix0, m_localMatrix1, matrix0, matrix1);   returnt = (matrix0.m_posit - matrix1.m_posit)  %  matrix0.m_front;} float CustomSlider::CalculateSpeed (){   dMatrix matrix0;   dMatrix matrix1;   // calculate the position of the pivot point and the Jacobian direction vectors, in global space.    CalculateGlobalMatrix (m_localMatrix0, m_localMatrix1, matrix0, matrix1);   dVector veloc0;   dVector veloc1;   dVector veloc0 (NewtonGetVelocity (m_body0, &veloc0));   dVector veloc1 (NewtonGetVelocity (m_body0, &veloc1));   return  (veloc0 - veloc1) %  matrix0.m_front;}`

you can also modify the SubmitConstrainst so that is save the calculated values an dyou cna save the extra CalculateGlobalMatrix that you need to make if you implmenet funtions,
it should be very eassy to do that.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

I'll try it. I'm studying very seriously linear algebra. Too many mysteries are becoming clear now, and I'm getting more dimensions about the wonder of Newton dynamics. Very impressive job!
Developing a racing game.

Posts: 132
Joined: Sat May 17, 2008 9:17 am

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

Is there a way to use the new CustomSlider without including all the Newton source dragged in with NewtonCustomJoint.h?
Maybe implement a slider with the JOINTLIBRARY_API CustomJoint6DOF? Must read up on custom joint usage...
Aphex

Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

yes, you can just copy the code for the joint and the base class.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

Well, that needs dMatrix.h, which pulls everything in again
Aphex

Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

you can replace dMatrix with any oteh matrix class, it is only a couple of funtions

do a global search and replace for dMatrix and change to you matrxic class, then rpelce each fo eth fuintion in teh matrix clsss with the equivalient of yours.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: HELP! Cannot understand NewtonSliderGetJointPosit

lol ok I'll give that a go
Aphex

Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK