Car Physics

Posted By: LoneWolf

Car Physics - 07/25/04 01:16

I have a working car using the physics system but it does have some problems. At the moment i have the main body of the car which is connected to 4 suspension blocks using PH_SLIDER. The wheels are then connected to these suspension blocks using PH_WHEEL. The can moves when i rotate the wheels and the car turns when i turn the front wheels using phcon_setmotor.
there are however some strange results i get. Sometimes the wheels seem to begin to fall off to the side etc even though they are on a slider. I think its because i am using PH_SPHERE when i set the wheels type and mass but PH_CYLINDER does not seem to work at all. The car will not move if i use PH_CYLINDER. Is there a bug that i am missing or am i doing it right using PH_SPHERE???
I might be able to upload a demo a bit later on if needed

any ideas?

thanks in advance
Posted By: Helghast

Re: Car Physics - 07/25/04 01:56

try ph_poly, that works for me (atleast if i understood youre question right, else paste the code here please or speak to me over msn/icq).

regards,
Posted By: LoneWolf

Re: Car Physics - 07/25/04 05:38

Thanks for the reply

PH_POLY does not seem to work very well because the wheels arent perfectly round and i dont want to add any more detail to them if i can help it

My wheel action looks like this

Code:
action Car_Wheel
{
wait (1);
phent_settype (my, PH_RIGID, PH_SPHERE);
phent_setmass (my, 20, PH_SPHERE);
phent_setdamping (my, 0, 100);
phent_setfriction (my, 100);
phent_setelasticity (my, 60, 5);
phent_setgroup (my, 2);
// ph_setgravity (vector (0, 0, -386)); // Set gravity for the world
}



thanks again
Posted By: Helghast

Re: Car Physics - 07/25/04 15:50

well, that should work, though i dont get where you set the "hinge" to attach the wheels to the car.

regards,
Posted By: Marco_Grubert

Re: Car Physics - 07/27/04 09:19

Remember that PH_WHEELs have built-in suspension (see Constraints in manual). You can get away with creating a chassis, 4 wheels (PH_SPHEREs) and each linked to the chassis via PH_WHEEL.
Posted By: Helghast

Re: Car Physics - 07/27/04 14:28

that's what i have, i dont know why he added extra models to it and jointed them with sliders...
maybe he wanted to make a moonbuggy or something.

regards,
Posted By: LoneWolf

Re: Car Physics - 07/27/04 19:14

I tried just using the car body and 4 wheels but if could not get the suspension working.

I guess you are talking about

Quote:

Parameter 6 : nullvector or spring-damper constants in the 0..100000 range, e.g. (90000,100,0)




I tried this but the wheels would slowly fall off the car. If i used a high value and suspended the car above the ground they dropped to the ground quickly. If i used a small value they slowly fell to the ground. They never stopped falling till they hit something though, should it not be limited to how far they move?

ive been playing about with different values whenever i get the chance and the car seems to be working quite well now. I made the back wheels into hinges because if i used PH_WHEEL the wheels would suddenly begin turning (as in turning the car) under speed. I also still have a problem where the wheels begin to fall of (to the side) whenever i make a sharp turn, im guessing thats the bug mentioned on the bug pages?

thanks again
Posted By: JRAV

Re: Car Physics - 07/28/04 00:43

Hi,

I'm also working on a car physics model, and also encountered problems with the hinge, such as wheels turning into the wrong direction or in worst case fly of the car.

The only solution seems to be setting friction to zero, at least in higher speeds,, then, however, you have the problem that when the car drives against another physics object (e.g. a 15kg cone), the car starts flying but not the cone.

I did not worry about suspension yet.
Posted By: LoneWolf

Re: Car Physics - 07/29/04 22:20

I cant set friction to 0 because i am using the turning of the wheels to move the car (phent_setmotor)

thanks anyway
© 2024 lite-C Forums