A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Auradrummer » Sat Nov 15, 2008 8:30 am
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.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
by Julio Jerez » Sat Nov 15, 2008 9:45 am
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: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Auradrummer » Sat Nov 15, 2008 9:56 am
Yes, I'm using the 2.0 Beta.
I'm creating a common slider, NewtonCreateSlider.
Developing a racing game.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
by Julio Jerez » Sat Nov 15, 2008 11:04 am
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: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Auradrummer » Sat Nov 15, 2008 11:35 am
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.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
by Aphex » Thu Nov 27, 2008 9:07 am
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
-
by Julio Jerez » Thu Nov 27, 2008 9:20 am
yes, you can just copy the code for the joint and the base class.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Aphex » Mon Dec 01, 2008 7:00 am
Well, that needs dMatrix.h, which pulls everything in again
-
Aphex
-
- Posts: 144
- Joined: Fri Jun 18, 2004 6:08 am
- Location: UK
-
by Julio Jerez » Mon Dec 01, 2008 8:47 am
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: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Aphex » Tue Dec 02, 2008 4:29 am
lol ok I'll give that a go
-
Aphex
-
- Posts: 144
- Joined: Fri Jun 18, 2004 6:08 am
- Location: UK
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 19 guests