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 Dave Gravel » Sun Oct 19, 2008 3:09 pm

It's surely because you set your steering torque so directly.
You need to make it pass in a procedure to make it updating one by one * your frame update.

If you have reproduce this procedure make sure it is correct.
void MultiBodyCar::ApplySteering (dFloat value)

In resumed if you try to use ApplyTireSteerAngle directly the value is surely so big and badly set to the matrix tire joint.
ApplyTireSteerAngle(0, m_steerAngle);
ApplyTireSteerAngle(1, m_steerAngle);
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 20, 2008 11:25 am

I have reproduced this procedure but it is exactly the same. (setting a member variable increasing by small steps instead of the value directly , etc.)
However, my vehicle turns right after a few seconds when I go straight. I have increased the tire rolling drag from 0 to 20 since at 0 the car seemed to be on the ice (so much drift ...)

I have verified that it's not the float imprecision that causes the problem (going at 0.1 instead of 0, for example). And it's not.

Also, my tires are made of simple DirectX cylinders, By default, they are oriented correctly (their height along the z axis, so they roll on the x axis, that's fine)
But when I receive the matrix from Newton SetTransform callback, it first rotate the cylinders by 90 degrees on the y axis, then rotates them for rolling and steering then translates them to the correct position. I need to pre-rotate the cylinders by 90 degrees before so they ae placed correctly. But why are they getting rotated by Newton ?

P.S. : I saw that I could send my code on this forum so somebody could see the driving with their eyes and be able to understand more esily what is the problem.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Mon Oct 20, 2008 12:26 pm

I saw in the Newton wiki that cylinders collision primitives are aligned with th x axis so that would explain why
Newton rotate them. Tell me if I'm wrong.

Now here's my project so far :

Note it works on windows, with the DirectX SDK 9.0 (March 2008) installed.
I have not included the Newton DLL, as you must have the newton 2.0 sdk installed. Also because this too big in the zip. So you just have to copy newton dll next to the exe file and it will work.
I've just provided the exe, so you may get a feeling of the driving and you'll probably know what's wrong.
The vehicle by the w, s, a, d keys.

P.S. : You must use winRAR to unzip the file
Attachments
Vehicle avec Newton 2.rar
(114.47 KiB) Downloaded 302 times
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Wed Oct 22, 2008 8:02 am

Anyone has looked at it ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Julio Jerez » Wed Oct 22, 2008 10:18 am

it is better if you add teh libraries.
ussually the current library will not work because it mayb have new changes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Wed Oct 22, 2008 10:38 am

But just Newton DLL is 650 Kb and maximum allowed size on this site is 256 Kb !
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Julio Jerez » Wed Oct 22, 2008 10:58 am

even compresses?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Wed Oct 22, 2008 11:01 am

Of course !
If I compress the whole thing (the exe and the dlls) in a zip archive, it is still 419 Kb.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Wed Oct 22, 2008 8:33 pm

So I've placed the zip file on my website, so it's bigger, there's all the code and the VC++ projects. Just missing the DirectX 9 SDK

Here's the link :
http://frankdevelopper.com/newton/physicsvehicle.zip
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Thu Oct 23, 2008 10:22 am

Anybody has an idea ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Thu Oct 23, 2008 10:20 pm

I've placed everything it needed in the zip file, including the DirectX DLLs. It has everything to work alone. The exe is already compiled, and there is the project files and the source code for those who wanna take a look at it.

Thanks in advance for someone who's gonna take time
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Fri Oct 24, 2008 8:41 am

Why doesn't anybody check it ?
It can be executed I think.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby Dave Gravel » Fri Oct 24, 2008 11:09 am

I have test but here the exe generate a error.
Same when I rebuild the code, and I don't have seen from where it happening.
The error happening when newton try to init.
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 » Fri Oct 24, 2008 1:03 pm

Strange ...
I have Windows XP SP3
I have an x64 architecture and I'm using Win32 to manage window.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: CustomMultiBodyVehicle joint - How to use it ?

Postby frankk » Sun Oct 26, 2008 2:24 pm

Since my code doesn't seem to work on other computers,

could you tell me if my matrix (for positioning the vehicle is correct ?
Code: Select all
dVector front(1, 0, 0, 1);
dVector up(0, 1, 0, 1);
dVector right(0, 0, 1, 1);
dVector vpos(0, 2, 0, 1);
dMatrix mat(front, up, right, vpos);


And I needed an offset for my tires, as it's not a mesh so I can't get the matrix there.

Code: Select all
// Create the tires offset vectors.
D3DVECTOR frOff = {  0.8f, -0.2f,  0.8f };
D3DVECTOR flOff = {  0.8f, -0.2f, -0.8f };
D3DVECTOR rrOff = { -0.8f, -0.2f,  0.8f };
D3DVECTOR rlOff = { -0.8f, -0.2f, -0.8f };


The vehicle is positionned facing the x axis, as I want, but it doesn't move correctly.
I've tried tweaking the params in all the possible way, but nothing worked.

Anybody can help ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 10 guests