tokamak physics thread 4

Blitz3D Forums/Blitz3D Programming/tokamak physics thread 4

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

It's difficult to get a nice balance between sliding or not, but I've added a few extra bits -

At very very low speed the car body has its linear damping increased to stop it slowly sliding around.

When in midair it has an upwards impulse applied every frame to negate gravity to a certain degree - this allows me to have high normal gravity to keep it on the ground, but still allows the car to make vast jumps in gentle arcs.

The angular damping of the body is increased dep. upon speed, to allow it to hold in a straight line. This also takes into account the steeringangle, allowing you to fling the car sideways if you want.

I'm using these friction settings...

TOKSIM_SetMaterial 1,6,0.15 	;objects 6,12		3,0.15
TOKSIM_SetMaterial 2,2,0.15		;ground	2,10		3,0.15
TOKSIM_SetMaterial 3,6,0.15		;ground	2,10		3,0.15


...for ground objects, and front and rear wheels seperately, allowing me to vary the balance of the car, or create a handbrake effect by decreasing friction on the rear wheels.

For braking, I'm using a negative torque on the driving wheels, which in this case are primarily the front wheels. The rear wheels can be driven to the certain variable degree to promote oversteer, but primarily front wheel drive gives a nicely balanced car.

I'm also allowing the player to balance the car in the air by pitching the nose up and down with the throttle and brake, to allow a bit more control. I might introduce a slight steering effect in the air also.

Note that this lot is for my Stunt Car Racer clone, not for a serious driving sim.