Another verlet question - suspension.

Blitz3D Forums/Blitz3D Programming/Another verlet question - suspension.

Stevie G(Posted 2005) [#1]
I realise that this topic has had the arse kicked out of it in the past but I can not find a download or code for the community verlet car project which DMC started - anyone remember this?

I have a working car model which turns / slides rolls & collides with other cars etc.. It's physically quite accurate on a flat surface and uses Jacobsens verlet method.

In making the 9 particle cage completely rigid it causes the car to slip & slide unrealistically on bumpy terrain. (e.g. only one wheel is actually touching the terrain on some occasions when at least 3 should be & a traction force is only applied to which is touching the ground )

I now realise that having a suspension model is a must and
what I'm looking for are ideas on the best way to incorporate this into an existing verlet system. The contraints I'm using allow for a stiffness component of less than 1.0. Do I need a new contraint type or will this be sufficient?

I thought of having an additional 4 x particles directly underneath the wheel particles which have rigid contraints as shown below but have springs attaching each particle to the corresponding wheel particle.

Is this the way to go ... please help? I'm more than willing to share code once I'm finished.





10--11
! \/ !
! /\ !
13--12




flying willy(Posted 2005) [#2]
I'd prolly use ODE to be honest...


NewtSoup(Posted 2005) [#3]
Kudos to you Stevie for getting as far as you have done, I dont know the first thing about verlets and have yet to find a step by step guide to their principles and practice. Keep at it and you can write your own version of libraries like ODE and Tokomak and have people like flying willy begging for your code

/salute.


Stevie G(Posted 2005) [#4]
Thanks Luke, setting up the verlet cage and applying forces based on rear car physics is quite straightforward. There's loads of resources online but none which explain a suspension model. I'm hoping that Bouncer , DMC (if he's still about ) , BotBuilder or anyone who has done some advanced verlet stuff reads this and is feeling generous! I won't be giving up on this yet!!

@ Flying Willy - using a wrapped 3d party library is a cop out for me. I'd much rather code the engine myself as it's easier to implement in my own code.


IPete2(Posted 2005) [#5]
Stevie,

E-mail me and I'll let you have the demo I have - they are archived on my drive.


IPete2.


Stevie G(Posted 2005) [#6]
Cheers IPete2 - e-mail on route.


Jeremy Alessi(Posted 2005) [#7]
You should get your friction by utilizing pressure i.e. if only one wheel is on the ground the friction is increased due to higher pressure. You wouldn't even need a real suspension system but if you wanted the wheels to move you'd have to put spings in place.


Stevie G(Posted 2005) [#8]
Not sure I get what you're saying Jeremy?

Say I have a max friction 10.0 for all 4 wheels - apply this evenly between the no of tyres on the ground ..e.g.

1 tyre friction 10
2 tyre friction 5 each
3 tyre friction 3.3 each

etc..

If this is what you mean then I'm not sure it would work. Can you explain more?

I do already apply a roll restistance to each tyre in the opposite direction of the tyre orientation if the wheel is on the ground but this is based on a Constant RollResistance Force * velocity component in the tyres forward direction.


Jeremy Alessi(Posted 2005) [#9]
Yeah well you should have a friction force per tire calculated by surface area / weight ... something like that. So 4 tires has 4 times the surface area so it's less pressure per tire. Friction would still be less on only 1 tire but if you bring pressure into it the whole weight of the vehicle on 1 tire would be a lot more pressure and thus more friction so your vehicle wouldn't go nuts as the friction would be reasonable.


Clarks(Posted 2005) [#10]
What you can do is use a matrix to perform some calcuations of where the wheels should be positioned relative to the body in the cars body coordinates.

What your interested in is directly setting the x and z coordinates of each wheel relative to the car and let a verlet constraint handle the y coordinate. But it highly depends on how your verlet particles are connected as they must be connected to support suspension.


Stevie G(Posted 2005) [#11]
I think I got you Jeremy, basically calculate how the car mass spreads a load over each of the wheels which is touching the ground. I'm pretty sure I could do that.

I'm trying something similar atm Clarks - the suspension is reasonable i.e. the car body moves about while the wheels are better at hugging the track. I'm getting wheels coming off the surface when I do a fast turn but I think a kind of downforce applied as above should stabalise this. Here's hoping!!

The cool thing is that the body automatically nosedives when you slam the brakes on now and vice verca when you accelerate.


Clarks(Posted 2005) [#12]
i would like to play a demo stevie.


Stevie G(Posted 2005) [#13]
Once I have this stable I'll post a demo. Trouble with the system I'm using is that the suspension cage below the body has is obviously more flexible than the body and it's breaking with hard collisions. I'll keep playing with this though.


NewtSoup(Posted 2005) [#14]
Well a real car suspension works something like this

the wheel is supported on a swingarm and a spring/damper limits the up/down movement think of the triangular shape of a formula 1 car (Indy500 car for you people in the US ;) )
you could use this regardles of the actual shape of your car because the verlets and constraints are not visible right? only the meshes attached to them

now the spring (having looked up on the net) a constraint is like an infinately stiff spring. soooooo what I would do is add a default parameter to all constraints saying that they are of stiffness 1 and then setting that to <1 would allow "error" in their lenght over a period of time but the relaxation function will still bring them back to their natural length over a period of frames.

just an idea I may be reading wrong.

so one side of your car would look like (from the back)



   shared verlet by car body And "spring"
   |
o--o\
|\/| \<-----this Constraint has "relaxed" stiffness And can vary in Lenght
|/\|  \
o--o---o<---wheel here on this verlet
   ^
   |
   |
   Shared verlet by car body And swingarm (2 of To make the arm And make a hinge)


this might have been what you had in mind anyway


NewtSoup(Posted 2005) [#15]
This is what gives me the above idea:


The number of necessary iterations varies depending on the physical system simulated and the amount of motion. It can be made adaptive by measuring the change from last iteration. If we stop the iterations early, the result might not end up being quite valid but because of the Verlet scheme, in next frame it will probably be better, next frame even more so etc. This means that stopping early will not ruin everything although the resulting animation might appear somewhat sloppier.




Source: http://www.gamasutra.com/resource_guide/20030121/jacobson_pfv.htm

seems to me that at the point where you compare the actual difference in length of the constraint to its restlength and correct if you intentionally slow the rate of change you will simulate a perfectly damped spring. (perfectly damped is one that returns to its rest length from a displacement with no oscillation)


NewtSoup(Posted 2005) [#16]
Yep it works, I just did a global constraint change on someone elses code so that it takes twice as long for the constraints to return to their natural length and now the falling cube deforms as if it were made of sponge when it hits the "ground"


Stevie G(Posted 2005) [#17]
I was setting up the verlets differently - directly beneath the rigid body but I see how the above verlet / constraint combinations would make it far more stable provided I add more constraints than you suggest -e.g. connecting the wheel to a few more of the rigid body verlets.

I'm already doing what you suggest to get springs working. I may be back for more help

Thanks Luke .. will post back with results.