Plane physics
Hi,
I am trying to model the physics of a car going on a random terrain. I don''t want advanced physics. The problem is i don''t now how to determine what will happen to the car if a wheel is not touching the terrain. How do i rotate the car...what happens to it.
We are the BORG. Resistance is futile!!!
http://www.etse.urv.es/EngInf/assig/si2/cardynamics.pdf
Edit: Forgot that was a 2D solution only.
[edited by - Mastaba on June 29, 2003 2:24:28 PM]
Edit: Forgot that was a 2D solution only.
[edited by - Mastaba on June 29, 2003 2:24:28 PM]
Depends on realistic u want to get.
Let's say you take the easy way out and don't have shock absorbers on the car.
Then it is marginally simple.
Get the height of the terrain at each of the four wheels (the bottom of the wheel not at the wheel axle). Discard the lowest wheel. Find the plane equation of the plane contain the other 3 wheels. Then plug the x,z coords of the lowest wheel into the plane equation to calculate the height for that 4th wheel (which was the lowest). Now all wheels are in the same plane.
Take the original localZ of the vehicle and cross it with the normal of the plane now containing all 4 wheels. This is the new local x for the model. Then cross the newlocalx with the plane normal to obtain the true final localZ of the car.
Now fill in a 3x3 matrix with this coordinate system. This is now your cars orientation.
Now pick any 2 wheels along the diagonal, add their coordinates together and divide by two. This is the new center point of the car and should be set as the cars new world coordinates.
That should do it. Adding shocks will be left as an excercise to the reader.
It works, believe me. Now another problem you will definetly have is making sure the car doesnt stick through terrain which can happen with this technique quite easily.
If there is like a bump and the wheels straddle the bump it can cause the middle of the car to dip into the terrain.
I'll leave it to the clever reader to fix that problem too, also with little extra work u can do stuff like detect when the front wheels drop beyond a certain threshold when compared to the back wheels and quit sliding the car along the terrain and set it "Free" to fly though the air until it collides with the terrain.
The way I described sort of makes it look easy and it is, but there is a LOT of infrastructure to be done in order to pull it off, but if u got the infrastructure it really is that simple.
Now making absolutely sure the care never ever penetrates the terrain is the last 10% of the problem, and the last 10% is always the hard part in my experience.
Jeff
[edited by - duke on June 29, 2003 12:02:57 AM]
Let's say you take the easy way out and don't have shock absorbers on the car.
Then it is marginally simple.
Get the height of the terrain at each of the four wheels (the bottom of the wheel not at the wheel axle). Discard the lowest wheel. Find the plane equation of the plane contain the other 3 wheels. Then plug the x,z coords of the lowest wheel into the plane equation to calculate the height for that 4th wheel (which was the lowest). Now all wheels are in the same plane.
Take the original localZ of the vehicle and cross it with the normal of the plane now containing all 4 wheels. This is the new local x for the model. Then cross the newlocalx with the plane normal to obtain the true final localZ of the car.
Now fill in a 3x3 matrix with this coordinate system. This is now your cars orientation.
Now pick any 2 wheels along the diagonal, add their coordinates together and divide by two. This is the new center point of the car and should be set as the cars new world coordinates.
That should do it. Adding shocks will be left as an excercise to the reader.
It works, believe me. Now another problem you will definetly have is making sure the car doesnt stick through terrain which can happen with this technique quite easily.
If there is like a bump and the wheels straddle the bump it can cause the middle of the car to dip into the terrain.
I'll leave it to the clever reader to fix that problem too, also with little extra work u can do stuff like detect when the front wheels drop beyond a certain threshold when compared to the back wheels and quit sliding the car along the terrain and set it "Free" to fly though the air until it collides with the terrain.
The way I described sort of makes it look easy and it is, but there is a LOT of infrastructure to be done in order to pull it off, but if u got the infrastructure it really is that simple.
Now making absolutely sure the care never ever penetrates the terrain is the last 10% of the problem, and the last 10% is always the hard part in my experience.
Jeff
[edited by - duke on June 29, 2003 12:02:57 AM]
super genius
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement