1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Sat Oct 17, 2009 9:12 am

Hello, after I had some problem with the raycast function with 1.53 and reading all topic saying to update to 2.0 I decided to try, but after succeding compiling my program with 2.0 I see too strange things and don't know how to debug, because everything was ok with 1.53...
About my "scene" I have a vehicule using simple joints, a character using same types of joints and attached to the vehicule with custom joints, both made of simple and coumpound primitives, I have a world made of a collision tree primitive, and some cube attached to nothing (except gravity).
After a compiled with 2.0 sdk the cube was the onnly thing seaming normal (falling on the floor) except it bounced more and more. The vehicule seamed broken with anarchic movement. Removing all applied forces and torques and incativating every custom joints changed nothing.

Have you changed the way the matrix works ? Is there something that must be initialised ? Please help me because I don't know where to search... here a few thing I do (wrong I hope):

Code: Select all
///basic initialisation...
   nWorld = NewtonCreate (PhysicsAlloc, PhysicsFree);
   NewtonSetSolverModel(nWorld,0);
   NewtonSetFrictionModel(nWorld,1);

   defaultID = NewtonMaterialGetDefaultGroupID (nWorld);


   NewtonMaterialSetDefaultSoftness (nWorld, defaultID, defaultID, 1.0f);
   NewtonMaterialSetDefaultElasticity (nWorld, defaultID, defaultID, 0.05f);
   NewtonMaterialSetDefaultCollidable (nWorld, defaultID, defaultID, 1);
   NewtonMaterialSetDefaultFriction (nWorld, defaultID, defaultID, 1, 1);
   NewtonMaterialSetCollisionCallback (nWorld, defaultID, defaultID, NULL, GenericContactBegin, GenericContactProcess);

//add some geometry
      NewtonCollision* collision[2];
      D3DXMATRIX location,mat0;
      D3DXMatrixIdentity(&location);
   //
      D3DXMatrixTranslation(&mat0,0/kscale,2.42f/kscale,0/kscale);
      collision[0] = NewtonCreateBox (nWorld, 2.23f/kscale,4.93f/kscale,0.4f/kscale,0, &mat0._11);
   //
      D3DXMatrixTranslation(&mat0,0/kscale,5.31f/kscale,0/kscale);
      collision[1] = NewtonCreateBox (nWorld, 7.28f/kscale,0.87f/kscale,0.92f/kscale,0, &mat0._11);
      
      NewtonCollision* collcompoud=NewtonCreateCompoundCollision(nWorld,2,collision,0);

      body = NewtonCreateBody (nWorld, collcompoud);

      NewtonReleaseCollision (nWorld, collision[0]);
      NewtonReleaseCollision (nWorld, collision[1]);
      NewtonReleaseCollision (nWorld, collcompoud);
      //     *     *     *     *     *     *

      

      NewtonBodySetUserData (body, &data);
      NewtonBodySetTransformCallback (body, PhysicsSetTransform);
      NewtonBodySetForceAndTorqueCallback (body, PhysicsApplyForceAndTorque);
      V=D3DXVECTOR3(6.0f/kscale,4.93f/kscale,0.9f/kscale);
      mass = 0.2f;
      Ixx = 0.7f * mass * (V.y * V.y + V.z * V.z) / 12.0f;
      Iyy = 0.7f * mass * (V.x * V.x + V.z * V.z) / 12.0f;
      Izz = 0.7f * mass * (V.x * V.x + V.y * V.y) / 12.0f;
      NewtonBodySetMassMatrix (body, mass, Ixx, Iyy, Izz);
      NewtonBodySetMatrix (body, &location._11);
      PhysicsSetTransform (body, &location._11,0);

//some joint
      point=D3DXVECTOR3(0,0,0);
      dir=D3DXVECTOR3(1,0,0);

      JCB= NewtonConstraintCreateHinge(nWorld, &point.x, &dir.x,body0, body1);
      NewtonHingeSetUserCallback(JCB,b01Callback);   
      NewtonJointSetUserData(JCB,this);


Hope I'll have an answer, thanks.
Last edited by greg2fs on Mon Nov 16, 2009 10:29 am, edited 1 time in total.
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 nothing goes right :(

Postby Stucuk » Sun Oct 18, 2009 6:01 am

NewtonMaterialSetCollisionCallback is different in 2.0 . There is no ContactBegin callback anymore.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: 1.53 -> 2.0 nothing goes right :(

Postby greg2fs » Mon Nov 16, 2009 10:28 am

ContactBegin is still there with another name, I am retry to update to 2.0 after having abandonned.
I currently I a problem with a slider (legacyjoint) and it seems it is not supported with 2.0 because even in the samples the only code using NewtonConstraintCreateSlider is commented.

Then my question is : can't I use NewtonConstraintCreateSlider no more and have to use a customjoint ?
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 nothing goes right :(

Postby Stucuk » Mon Nov 16, 2009 11:17 am

greg2fs wrote:ContactBegin is still there with another name


While it has the same parameters and technicaly the same main "goal" (To allow you to decide if an object should collide) its not the same. With ContactBegin you had to store the userdata in it as you only got it there, with 2.0 you don't need to store the Userdata.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby Julio Jerez » Mon Nov 16, 2009 3:05 pm

The intenal CrateSlider joint have a bug in some of the latest version of 2.00.
I found by accident last weekend. I intruced it when I commneted out a line and forget to uncomment.
I fixed it already, you get it with 2.11

can you use the slider in the Joint Library?
The joint in the joint library are more polished and more flexible than the internal joints.
you can modifyed them to get you own interface

2.11 coem with many many intenal bug and weak codeing fixed. '
I fix a big bog with convex collision when working in simd mode.

I foudn all these stuff buidl teh code with Visual studio 2010 tema edition.
I have a code analysis feature that detect many potenacil code weaknesss.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Tue Nov 17, 2009 5:23 am

I downloaded the 2.11 and still seems to bug. In the slider callback the distance returned by NewtonSliderGetJointPosit is "0" and some frames later it return "1.#QNAN00" and my model explode !
I'd prefer keep using the legacy joint because I use it from the begining of my project, but I think I'll try the Joint Library...


EDIT: CustomSlider require a matrix as a pivot and dir, how can I use two vectors instead because I don't know any function to create this matrice from 2 vectors with directx...
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Tue Nov 17, 2009 8:27 am

I tried to use customslider but I can't compile... with legacy functions I just have to newton header, lib and dll to compile it's easy and I like it ! But with the joint libray I don't understand what I must add to my project, I tried adding all header and source but miss something, tried adding customjoint lib and dll but get doubles, can you help me using the joint library ?
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby Julio Jerez » Tue Nov 17, 2009 8:38 am

Oh you downloaded 2.11
but that one is no ready yet a put there for some one to test it. teh last stabel version is 2.10

anyway the smake joint is teh jont library should work, it is better it you use th library.

there is a set of beginner tutorials al using joint library, and they are a simple projects
They are all minimal set ups to get ta project up and running.
http://newtondynamics.com/wiki/index.php5?title=Tutorials

try downloading the project and see who it is set up. make sure you have there same compiling setting. as the Newton library.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Tue Nov 17, 2009 12:53 pm

I looked at the tutorial codes but I really don't understand what I must include, there are many files in the tutorials must I add as many files just to use customslider ??
If I look at customslider.h I see it uses NewtonCustomJoint.h and the .cpp includes also CustomJointLibraryStdAfx.h, then I tried to add customslider.cpp, NewtonCustomJoint.cpp and CustomJointLibraryStdAfx.cpp but I get many warning and unresolved external symbol errors witch I can't understand... :cry:
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby Julio Jerez » Tue Nov 17, 2009 1:25 pm

if you are going to use teh c inteface you only need thre files
C:\Newton_200\NewtonSDK\sdk\JointLibrary.h
C:\Newton_200\NewtonSDK\sdk\dCustomJoints\Win32\Release\JointLibrary.dll
C:\Newton_200\NewtonSDK\sdk\dCustomJoints\Win32\Release\JointLibrary.lib

if you are use the CPP classes the you need all of the header file in the dJoint folder, dMath, and maybe dContainer
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Tue Nov 17, 2009 4:13 pm

OK, realy thanks for helping bad coders like me... I don't really understand the difference between using the library or classes, maybe it's just for more customization ? And then I suppose with my level, library will be perfect and it seem to compile then...
OK, I try it and tell you if it's better. Thanks
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby Julio Jerez » Tue Nov 17, 2009 4:25 pm

the libary have a c interface tha are wraper funtion to teh funtion of a class library.
using the classes you can derive from the classe directly
for you it is better to use teh C library, (the tree file I listed before)

the wiki demos uses that library too.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Wed Nov 18, 2009 2:59 am

It seems to work, but there's no function to get the joint position (like NewtonSliderGetJointPosit) using the library ?

EDIT: another thing, with N1.53 I controlled my motor handlebar adding a torque along the fork and the opposite torque to the motor, even if this last torque was applied to the center of the motor it worked perfectly, now the motor seems dancing and does anything.
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm

Re: 1.53 -> 2.0 NewtonConstraintCreateSlider no more supported ?

Postby greg2fs » Fri Nov 20, 2009 3:49 am

No answer... maybe I said something wrong ? I have another question, as I'm still can't use Newton 2 I am trying to correct bugs in my project using 1.53 but I think the problem comes from newton:
I still have my 2 wheels vehicule (made of legacy standard joints) and running on a tree collision, modeled in blender as a flat surface with a flat road on it, but if the vehicule seems collinding very well on this floor about 90% of the time it bounce as if there had a stone on the road in the 10% resting.
THen my question is: is it a know bug in newton 1.53 and is the problem can be solved with double precision lib ?

Thanks
Image
greg2fs
 
Posts: 32
Joined: Sat May 24, 2008 12:36 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest