Vehicle disappears after calling CustomMultiBodyVehicleAddTi

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Chris » Sun Sep 07, 2008 2:29 pm

I'm creating a Vehicle this way:

float front_dir[3] = {0,1,0};
float up_dir[3] = {0,0,1};
float vl_tirepos[3] = {10,5,-5};

vehiclejoint = CreateCustomMultiBodyVehicle(&front_dir, &up_dir, truckbody);

This works without problems, the body falls down. But, if i try to add tires, the vehicle-body disapears.

vl_joint = CustomMultiBodyVehicleAddTire(vehiclejoint ,0,&vl_tirepos, 10, 30, 10, 10, 100, 100);

I have tried many different values, but its allways the same problem...
Chris
 
Posts: 4
Joined: Sun Nov 16, 2003 8:43 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Aphex » Sun Sep 07, 2008 3:46 pm

30m wheel radius, 10m tyre width and 10m suspension spring length. That's one BIG vehicle!
Try something like:
CustomMultiBodyVehicleAddTire(vehiclejoint ,0,&vl_tirepos, 10, 0.5f, 0.8f, 0.5f, 100, 10.0f);
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Chris » Sun Sep 07, 2008 3:53 pm

I have tried you values. but its still the same.
Chris
 
Posts: 4
Joined: Sun Nov 16, 2003 8:43 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Nearga » Mon Sep 08, 2008 5:41 am

and what debug-panel says?
Nearga
 
Posts: 21
Joined: Thu Jul 31, 2008 11:47 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Chris » Mon Sep 08, 2008 10:24 am

I've noticed the the debug-displays for the body is allready disapearing when i call CreateCustomMultiBodyVehicle. So maybe the problem is allready there?

Edit: Thats not right, it just disapears when the body is not moving anymore.

Here is the complete test-code (For conitec's lite-c)

Code: Select all
   float front_dir[3] = {0,1,0};
   float up_dir[3] = {0,0,1};
   float vl_tirepos[3] = {100,50,-50};

   CustomJoint* truckjoint;
   NewtonBody* truckbody;

   level_load("test.wmb");

       wait(-2);

   newton_start();
   newton_toggledebugdisplay();

       wait(-2);

   truckbody = newton_addentity(truck, 1000, NEWTON_CONVEXHULL, onforceandtorquecallback);

   truckjoint = CreateCustomMultiBodyVehicle(&front_dir, &up_dir, truckbody);

   CustomMultiBodyVehicleAddTire(truckjoint ,0,&vl_tirepos, 10, 0.5, 0.8, 0.5, 100, 10.0);
Chris
 
Posts: 4
Joined: Sun Nov 16, 2003 8:43 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Nearga » Tue Sep 09, 2008 2:25 am

box disappears as body freezed.. press M 1-2 times - this toggle, may debug show freezed bodies or not
Nearga
 
Posts: 21
Joined: Thu Jul 31, 2008 11:47 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Aphex » Tue Sep 09, 2008 3:44 am

Have you tried putting the tyre pos nearer? Something in the range of 2 meters max, e.g. (2, -1, -2)
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Dave Gravel » Tue Sep 09, 2008 4:03 am

I'm not 100% sure but your tire value don't seen good and it can surely make problem with the spring force on final.

From what I seen your tire mass is wrong and so little for the frame vehicle mass.
Try to use higher tire mass value and i'm pretty sure it can fix your problem.
Try something like around, tire mass 20 or 40.

If this don't fix the problem, try to set the newton Architecture to 0 and see if it make a difference.
Good luck.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 725
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Chris » Tue Sep 09, 2008 6:28 am

I''ve tired what you said, but it didn't help.
I've noticed that the forceandtorque-callback is still called when the vehicle is disappearing. The onsettransorm-callback stops.
The last position of the vehicle is -2097152, -2097152, -2097152.
Does anyone have a small, working example of a "CustomMultiBodyVehicle"?
Chris
 
Posts: 4
Joined: Sun Nov 16, 2003 8:43 am

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Dave Gravel » Tue Sep 09, 2008 1:55 pm

I have many many exemples, but all is coded in pascal ):
I don't think that can't really help you.

I have two version of this Vehiclemultibodyjoint.
One is in pascal, it is the c++ version translated in pascal and the other I use the JointLibrary in coming with newton this one is build by Julio in c++.

This version use my pascal translation.
http://oxnewton.googlepages.com/Basic_R ... Scene2.zip

This one is build with the JointLibrary dll.
http://evadlevarg.googlepages.com/Basic_MegaDemo_b6.zip

you can find my vehicle setup in both demos.
in file
Unit1.pas and Basic_VehicleFromdll.pas
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 725
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Aphex » Tue Sep 09, 2008 3:00 pm

Chris wrote:The last position of the vehicle is -2097152, -2097152, -2097152.


Those numbers are *far* too large for the single precision version of Newton. You'll need to scale your sizes down - should be looking at around +/- 4k max.
Also, how large is your newton world?
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: Vehicle disappears after calling CustomMultiBodyVehicleAddTi

Postby Dave Gravel » Tue Sep 09, 2008 5:53 pm

Yes I think Aphex have get the hand on your problem...
The scale of your general object and your world size can cause the problem that you get.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 725
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests