Posted By: PadMalcom
Make car stick to ground - 08/15/13 09:02
Hi, I've implemented a simple car physic using the example from the manual:
My problem is, that the car does not stick to the ground and "falls" on the side quite often so that I can't continue driving. Any ideas how to avoid that?
Code:
function simple_car(){ ENTITY* car = ent_create("car.mdl",vector(100,-200,40),NULL); pXent_settype(car,PH_RIGID,PH_BOX); ENTITY* FLwheel = ent_create("wheel.mdl",vector(168,-170,17),NULL); ENTITY* FRwheel = ent_create("wheel.mdl",vector(168,-230,17),NULL); ENTITY* BLwheel = ent_create("wheel.mdl",vector(39,-170,17),NULL); ENTITY* BRwheel = ent_create("wheel.mdl",vector(39,-230,17),NULL); pXcon_add ( PH_WHEEL, FLwheel, car, 0 ); pXcon_add ( PH_WHEEL, FRwheel, car, 0 ); pXcon_add ( PH_WHEEL, BLwheel, car, 0 ); pXcon_add ( PH_WHEEL, BRwheel, car, 0 );//drive the car while(1) { pXcon_setwheel (FLwheel,-5,0,0); pXcon_setwheel (FRwheel,-5,0,0); // steer to the right pXcon_setwheel (BLwheel,0,500,0); pXcon_setwheel (BRwheel,0,500,0); wait(1); }}
My problem is, that the car does not stick to the ground and "falls" on the side quite often so that I can't continue driving. Any ideas how to avoid that?