NewtonUserJoint vs. NewtonCustomJoint

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonUserJoint vs. NewtonCustomJoint

Postby Marc » Sun Apr 08, 2012 2:12 pm

I'm trying to implement my own joint.

I found NewtonUserJoint, NewontJoint, and NewtonCustomJoint. All seem to be related to this problem or offer a solution. But I'm confused.

I checked packages/dCustomJoints. There are complete custom joints implemented. But the documentation here http://newtondynamics.com/wiki/index.ph ... tom_joints does not seem to use that. In that docu, there is no complete code of a joint, but the parts that are displayed, for example for the simple 2d joint, implement a method like this void Joint2D::LocalSubmitConstraints(const NewtonJoint* kpJoint). But such a method does not exist in the customjoints in dCustomJoints. So how should I do it?
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: NewtonUserJoint vs. NewtonCustomJoint

Postby Julio Jerez » Sun Apr 08, 2012 2:51 pm

the base class fo all joints is

class NewtonCustomJoint

the funtion init ste it all up,

Code: Select all
void NewtonCustomJoint::Init (int maxDOF, const NewtonBody* const body0, const NewtonBody* const body1)
{
   m_rtti = 0;
   m_autoDestroy = 0;
   m_joint = NULL;
   m_body0 = body0;
   m_body1 = body1;
   m_maxDox = maxDOF;
   m_world   = NewtonBodyGetWorld (body0);
   m_joint = NewtonConstraintCreateUserJoint (m_world, maxDOF, SubmitConstraints, GetInfo, m_body0, m_body1);

   NewtonJointSetUserData (m_joint, this);
   NewtonJointSetDestructor (m_joint, Destructor);
//   m_userData = NULL;
//   m_userDestructor = NULL;
//   m_userConstrationCallback = NULL;

}


after you do that you can use that as the base class of all you joints.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonUserJoint vs. NewtonCustomJoint

Postby Marc » Sun Apr 08, 2012 4:52 pm

Ok thx. :)

I found the tutorials in the application directory. There is a NewtonTutorial.sln which doesn't compile. It complains about NewtonMaterialGetBodyCollisionID not being defined. Looking at newton.h this function is commented out. remove that comment, it compiles, but I get tons of linker errors afterwards:

Code: Select all
1>CollisionShapeUtil.obj : error LNK2019: unresolved external symbol __imp__NewtonCreateConvexHull referenced in function "struct NewtonCollision * __cdecl CreateNewtonConvex(struct NewtonWorld *,class Entity *,int)" (?CreateNewtonConvex@@YAPAUNewtonCollision@@PAUNewtonWorld@@PAVEntity@@H@Z)
1>CollisionShapeUtil.obj : error LNK2019: unresolved external symbol __imp__NewtonHeightFieldSetUserRayCastCallback referenced in function "struct NewtonCollision * __cdecl CreateHeightFieldCollision(struct NewtonWorld *,char *,int *)" (?CreateHeightFieldCollision@@YAPAUNewtonCollision@@PAUNewtonWorld@@PADPAH@Z)
1>CollisionShapeUtil.obj : error LNK2019: unresolved external symbol __imp__NewtonCreateHeightFieldCollision referenced in function "struct NewtonCollision * __cdecl CreateHeightFieldCollision(struct NewtonWorld *,char *,int *)" (?CreateHeightFieldCollision@@YAPAUNewtonCollision@@PAUNewtonWorld@@PADPAH@Z)
1>CollisionShapeUtil.obj : error LNK2019: unresolved external symbol __imp__NewtonCollisionSupportVertex referenced in function "void __cdecl CalculateBoxdingBox(struct NewtonCollision const *,class dVector &,class dVector &)" (?CalculateBoxdingBox@@YAXPBUNewtonCollision@@AAVdVector@@1@Z)
:
:


Are they supposed to currently work? Am I doing something wrong?
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest