A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by fractile » Tue Mar 23, 2010 1:43 pm
I upgraded my project to use newton 2.18 and I now have problem with slider joints on Windows. At least hinge joints still work as before, but slider joints don't limit body's movement at all. It's as if the joint wasn't there.
I checked that my slider callback still gets called as before, but the NewtonSliderGetJointPosit() always returns zero:
- Code: Select all
unsigned int Body::newtonSliderJointCallback(const NewtonJoint* newtonjoint,
NewtonHingeSliderUpdateDesc* updatedesc)
{
const BodyTemplate::TJoint& joint = ((const Body*)NewtonJointGetUserData(
newtonjoint))->m_Template->getJoint();
// Apply joint limits
Ogre::Real position = NewtonSliderGetJointPosit(newtonjoint);
if(position > joint.m_Axis[0].m_High)
{
updatedesc->m_accel = NewtonSliderCalculateStopAccel(newtonjoint, updatedesc,
joint.m_Axis[0].m_High);
return 1;
}
else if(position < joint.m_Axis[0].m_Low)
{
updatedesc->m_accel = NewtonSliderCalculateStopAccel(newtonjoint, updatedesc,
joint.m_Axis[0].m_Low);
return 1;
}
return 0;
}
This is how I create the joint:
- Code: Select all
m_NewtonJoint = NewtonConstraintCreateSlider(m_Simulator->getNewtonWorld(),
origin.ptr(), direction0.ptr(), m_NewtonBody, m_Parent->m_NewtonBody);
if(joint.m_Axis[0].m_Low != joint.m_Axis[0].m_High)
NewtonSliderSetUserCallback(m_NewtonJoint, newtonSliderJointCallback);
The weird thing is that this same code works just fine when built and run on Linux. Even on windows everything else except slider joints seems to be working. During the upgrading I only changed the contact processing and a couple of other places where newton API had changed. I made no changes to the joint code above.
Any help would be appreciated!
-
fractile
-
- Posts: 37
- Joined: Wed Jun 07, 2006 2:26 pm
by Julio Jerez » Tue Mar 23, 2010 1:55 pm
newtonSliderJointCallback felt outof favor use the new CustomSliderJoint
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by fractile » Tue Mar 23, 2010 2:42 pm
I was afraid you would say that

I specifically wanted to use the old API, because it was just perfect for my needs and only required the one library. Why are the functions still there (Newton.h) if they do not work anymore?
Another thing: I don't quite understand how am I supposed to use the new joint library. The linux SDK package has headers and sources for custom joints, but no precompiled libraries or scripts/makefiles to build them myself. Or are they all included in the Newton.so library?
-
fractile
-
- Posts: 37
- Joined: Wed Jun 07, 2006 2:26 pm
by Julio Jerez » Tue Mar 23, 2010 3:10 pm
fractile wrote:Another thing: I don't quite understand how am I supposed to use the new joint library. The linux SDK package has headers and sources for custom joints, but no precompiled libraries or scripts/makefiles to build them myself. Or are they all included in the Newton.so library?
I realize that, In the next Linux Build I will make a Package that will make the Joint and animation into .a library. I did for Mac already
for now you can just Take the source file and place into your make file, there are not the many files plus the is a C interface you can use too, just like the function in the newton.so file.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by fractile » Wed Mar 24, 2010 11:48 am
Thanks for the help! I got the problem solved for now by changing my sliders to use the version from joint library.
Just out of curiosity, what is the future of the built-in joints (functions in Newton.h)? Are they going to be fixed or completely removed in coming 2.x versions?
-
fractile
-
- Posts: 37
- Joined: Wed Jun 07, 2006 2:26 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests