Very strange logger ... cannot understand!

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Very strange logger ... cannot understand!

Postby Auradrummer » Wed Jun 17, 2009 9:13 am

Hey people,

I'm scared about one thing here. I made a car in Newton, not using regular joints, and something very strange are happenning.
The wheels aren't firmly attached to the body. When the car falls, the wheels moves around the track everywhere.
But, when I print the matrix.m_posit of the wheels, the position there is fixed!

I suppose the m_posit gives me the position of the body in the space, right?

REEEEEEALLLLY strange!
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Very strange logger ... cannot understand!

Postby Julio Jerez » Wed Jun 17, 2009 11:13 am

As I explained to you before, making a car is not a trivial task.
I hope you accept that I have a lot more experience working with matrices and physics than you have.
When I need to make a car the method I use, is making a constraint joint that allow me to apply all of the forces that are part of the car and tire dynamics,
then let a non linear constraint solvers calculate all of the internal forces that drive the car body.

You do not have to take my word for it, if you look at all of the commercial physics engine; they too implement car physics by using a constraint solver.
The people making these car joint are not beginners, the large majority hold PHDs in teoretical physics, Math, or Computer science; and they too use constraint solvers.
In fact Car physics is so hard that all of the physics engines that pseudo laws of physics (liek impulsive solvers) have to implement special solvers just to solve the car physics.
With Newton I just use the same solver because Newton do has a pure Force based Newtonian constraint solver.

You can find literature in the internet about the force that act on a tire, but all that literature does not tell you the complete truth.
Most of the literature is taken from Books written by people running empirical test in laboratories.
They use a machine called dynamometer, a device that allow the researcher to place the tire fixed on an axis and make it
spin on conditions similar to what happens on the road.
Then they measure the forces on the tire patch and also the tire behavior.
The reason they do that is because the test is designed for making table of tire characteristic on different conditions.
Essentially what they are doing is making an empirical Law of a tire behavior.

What they do no tell you is how to calculate the forces that the Dynamometer apply to the tire and the force that the tire apply to the dynamometer,
which is what is needed for a simulation of a car in a computer.
To make it even more complex, they only run the test on one tire, but in a real car you have a set of tire,
which mean the forces generated by each tire have to compete with the forces generated by other tires.
In a software simulation the Job of the Dynamometer is done by a Newtonian constraint solver.

Essentially you apply empirical laws of friction to the tire, plus the law of Gravity, the forces generated by the engine, in general all the known forces,
and the constraint solver calculate all of the reactions forces between tire and floor, tire and car hub, collision with the environment and so on.
This is a complex task to take all from scratch, you need to use building blocks that already do part of the work for you.

For the Last time, I suggest you to using the car joint, and them after that if you want to learn how to make your own, you can learn a bit how other people did it and you move from there.
The one think I will tell you is that there is not such thing as car physics, cars obey the same laws of physics all other bodies obey, the difference is that cars are subjected to different constraints.
This is why people use physics engines to simulate cars, physics engine allow the person simulating the car to specify the constraint rules that car body should obey,
just the same way they specify the constraints rule that a door shoudl obey when it swings.

The moral is, the first step to make a car is not making a car with tires, it is making a collision system and a Newtonian physics solver.
Once you have those elements, then you learn a little about the laws that control a tire, and badabim badabum you can make a car.
Even when you have those elements working, you still need a lot of tweaking, heuristic and luck.
For example I created the basic car joint in Newton but it was not fun,
it took David Gravel experience with other vehicle simulation to make it fun to drive, there is a lot of experience that you are getting there.

I hope I am not offending you, but I only want to save you lot of aggravation, and frustrations pursing something that will lead you nowhere.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very strange logger ... cannot understand!

Postby Auradrummer » Wed Jun 17, 2009 12:12 pm

Master Julio,

Of course, you cannot offend me. Each time we speak, I learn more. My objective is not to build a nice car, but understand a bit more how the engine works and how things can be done. After I made my little project (and it is almost ended) I'll destroy it and rebuild everything using regular car joints. When I tried to make a car with joints, some time ago, a small problem was enough to make me stuck. I didn't know how to build a matrix, how to get angles, turn things etc. Now, I can do this. I have full idea, for example, how to simulate wings effects, generate a torque and better, make a damageable car.

My idea, from now, is only to know how to work with engine and get full power from it. There are a few things yet I don't understand. The proof of it is that I was at Newton Wiki yesterday and I can understand 90% how to work with all these functions. Because of it I started a very complicated project (I cannot think anything worse than cars). I think this is the better way to grow fast and solid!

This is the reason of all of this, and I thanks you very much for all the time you lost with me. Be sure, this time wasn't lost after all.

But ... do you have some idea of what happened with my matrix.m_posit? This shouldn't return the position of the wheel in the space? :D

After I solve it, I'll made a multibody car with a lot more knowledge than I had before ... :wink:
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Very strange logger ... cannot understand!

Postby Julio Jerez » Wed Jun 17, 2009 1:20 pm

send me a PM, I can help you out with what you are doing.

what grade school or college do you have?
has you taken a linear algebra class?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Very strange logger ... cannot understand!

Postby JernejL » Wed Jun 17, 2009 1:21 pm

Auradrummer wrote:But ... do you have some idea of what happened with my matrix.m_posit? This shouldn't return the position of the wheel in the space? :D


Do you grab up-to-date matrix from body during newtontransform callback? newton will not rewrite the original matrix which you sent when you created the body.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Very strange logger ... cannot understand!

Postby Dave Gravel » Wed Jun 17, 2009 1:57 pm

Maybe you get only the local matrix and not the global[Absolute], do you get it directly from the body ?
Because normally the tire is local from the chassis, the chassis can give the tire global[Absolute].
It depending from the vehicle implementation in use...
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: 801
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Very strange logger ... cannot understand!

Postby Auradrummer » Wed Jun 17, 2009 3:27 pm

Yes, I'm grabbing matrix during transformation callback. The code is very simple:

NewtonBodyGetMatrix(body, &matrix[0][0]);
printf ("position %f, %f %f \n", matrix.m_posit.m_x, matrix.m_posit.m_y, matrix.m_posit.m_z);

Just it.
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Very strange logger ... cannot understand!

Postby Dave Gravel » Wed Jun 17, 2009 3:49 pm

Do you have assign a userdata with this body ?
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: 801
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Very strange logger ... cannot understand!

Postby Auradrummer » Wed Jun 17, 2009 4:00 pm

Yes, I assigned an integer.
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron