CustomMultiBodyVehicle joint - How to use it ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Mon Oct 27, 2008 11:23 am

I don't think what I ask is really complicated. Why doesn't anybody answer ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Dave Gravel » Mon Oct 27, 2008 12:04 pm

Maybe the body vehicle matrix is not on the good axis.
Exemple if the front vehicle = the left side and the back = the right side it don't behaving same if you rotate the vehicle body.
Exemple if the front vehicle = the right side and the back = the left side the vehicle behaving totally differently.

You absolutely need to build the vehicle on the exact good axis.
If i'm not wrong by default the multibody is make to work in dir x and up y.
Remember you if one axis is wrong, like the pin tire or the vehicle body you are sure to get strange result because internally the multibody use this information to apply force and spring and joint value.
It is why that you need absolutly to have the good axis.
From my side with the mesh vehicle body I have make a little tool to rotate and scale my mesh at the good value ready to use.
In my personal MultiBodyVehicle code I have make some update too, for create my vehicle on all axis more easy.

It's hard to say what exactly is your problem but I think the axis is in relation with it...
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://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Mon Oct 27, 2008 9:10 pm

Just thinking ... if my camera is fixed and not moving, normally it shouldn't change anything ?

To try to summarize my problem, the thing that annoys in the driving is that when you set torque and you turn at the same time, instead of just changing it's direction a bit, the vehicle spins around the y axis way too much !

Hope it can clarify something.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Tue Oct 28, 2008 8:22 pm

OMG ... I think I've got something here ! My vehicle seems to be more realistic.

Just setting a material different for the tires and the ground, with different values of friction, and I have tweak the tire viscous angular drag and the mass of the vehicle compared to the tires.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Mon Nov 10, 2008 10:11 pm

It works well, thanks to everyone here !

But now I have a problem when adding two vehicles (cause we must use 4 of them in the final version)
They do not collide properly. When they hit each other, they pass a bit through and they collide. After, when they try to go in different directions, they are like attached together, partially inside the other.

I have tried setting continuous collision modes for both vehicles and tires.
The results are slightly better, but sometimes when they hit each other they still get linked after.

It's very strange. Does anybody knows how to prevent this.

I have also another small question. It is for the network part of our game. We thought we could pass the newton matrix over the network and set it to the other vehicle but apparently newton does not like it. Is there a way to do this ?

Thanks in advance.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Dave Gravel » Tue Nov 11, 2008 1:19 am

[I have tried setting continuous collision modes for both vehicles and tires.]
Normally it's not a good idea to use continuous collision with vehicle it can add more problem and can behav more strangly over terrain or big mesh.
It is so much collision processing and it remove all smooth effect on the vehicle and it can reacting a lot more hard.

[they are like attached together]
You can try to change the tire body NewtonBodySetJointRecursiveCollision mode to 0.
In newton you can find the raycast vehicle this one is ok for the multiplayer.
It can come complex to implement the multibody over network and it can cost a lot more bandwish.
It's not simple to implement the multibody because you can't make it drive with real control and precision.
Or they need a pretty complex implementation and on final with all vehicle it can cost a lot processing.
With the raycast vehicle you work with force, the multibody working with torque and wheel traction and steer control.
It's coming hard to say go at this exact position if you have only the torque and the steer.
With the raycast vehicle you can apply force and you can correct sliding or position or rotation without problem.
With the raycast vehicle you can cheat a lot with the force and it is less processing use.
It's a lot more simple to move a vehicle with the force to create AI and network.

The best if you like to pratice about it, create a system to record the vehicle movement and driving and acceleration with the multibody vehicle.
You can see it's easy to lose the control of this vehicle and it can behav differently that what you have recorded the first time.
With the raycast vehicle it's a lot more simple and you can execute the save and your sure to can get the same simulation.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Tue Nov 11, 2008 8:16 pm

I tried setting the joint recursive collision mode to 0,

and I got a strange result : When the two vehicles approached each other they did not collide, instead they just pass free as if nothing was there.

Since joint recursive collision mode prevents attached bodies to collide together, I can conclude that the two vehicles that the 2 vehicles are in the same joint ???

I looked at the code loading the vehicle to be sure it is really two distinct vehicles, and everything seemed fine. I also tried setting different joint IDs for the vehicles but it didn't change anything.

What do you think could cause such a strange behavior ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Dave Gravel » Tue Nov 11, 2008 8:31 pm

What do you use to create the vehicle body, a mesh ?
What is the default vehicle mesh size ?
The vehicle is in direction x1, y0, z0 Up x0, y1, z0 ?

Yes the body is ignored by other's body connected with joint.

Maybe something is not in the good space, do you use a 3d system that is based on Parent and Children object's transformation ?
If yes don't use this method because the 3d try to update the children with the parent info and it make conflic with final newton matrix.
Make sure all visual object is on a self space without parent children system on this way it don't receive two different matrix from both side.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Dave Gravel » Tue Nov 11, 2008 11:57 pm

I have forget your 3d system calcul the scale object directly in the matrix object ?
This can cause problem like you get because to pass a matrix with scaled value in newton you need to make it from a different way.
And if I remember good you can only pass a scaled matrix with convexhull shape.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Thu Nov 13, 2008 2:36 pm

For the AI who has to know if there's an obstacle in front of him, I want to use a RAYCAST.

For now, I draw line from the vehicle's front to the place where it looks (in its direction). That line is placed fine, that's not the problem.
I could raycast between these two points and know if there is a rigid body in the way, but this information will be received in a callback.

Is there a way to get this information in the same call ? For example, raycast this line and return me a value if there is something in the way, instead of waiting for the callback ?

Tell me if I'm not clear.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron