Car control

Blitz3D Forums/Blitz3D Programming/Car control

Pete Carter(Posted 2007) [#1]
for my main project ive been testing out how the player can drive a car around the level. its a rts style game but i would like to have control of the car not unlike skidmarks with the same simple physics. I want the cars to be able to jump over terain and skid etc, do i need to get a physics wrapper for this or can it be done quite well without, if you know how its done. whats the simplest way. I want more fun than realistic.

JV_ode looks like theres a lot of code to understand just to get basic stuff running, but it seams the best out of the libs after testing the demos?

Also i want split screen with 4 players controling there own cars


big10p(Posted 2007) [#2]
A physics wrapper would probably be overkill for this, unless you want your cars to crash and roll/tumble realistically.

Have you looked at the driver demo that comes with blitz3D? it's in the mak folder. Not sure it implements skidding but that probably wouldn't be too difficult to add.

Other than that, I'm sure members with better physics ability, like StevieG, will be able to help. :)


Rob Farley(Posted 2007) [#3]
Personally what I've done in the past is have a pivot for the front axil and a pivot for the back axil, the back axil is dragged by the front axil by doing:

pointentity backaxil,frontaxil
moveentity backaxil,0,0,entitydistance(backaxil,frontaxil) - carlength

Then you just deal with physics on the front axil, ie, move that one forward etc and the back will follow. Then you align the car model to the back axil.

if you want to make the car skid left or right simply shove the back axil in a direction.

So once you've done your first correction of the back axil ^^ up there simply

moveentity backaxil,skid,0,0
pointentity backaxil,frontaxil
moveentity backaxil,0,0,entitydistance(backaxil,frontaxil) - carlength

This will make the back drift.

That's the basic principle anyway, obviously you'll want to work out the roll of the car too, but that should give you a good start.

Check out my car demo (car.exe.zip) from my downloads page, this hasn't got ramps or anything, but it'll give you an idea of the 'realism' this technique give.

http://www.mentalillusion.co.uk/downloads.php


Pete Carter(Posted 2007) [#4]
.Rob. : nice example m8 thanks for the tip, its this kind of simply effect i was looking for. I feel like doing a Puki hand over the code and media!

big10p : that what i was thinking ive looked at driver demo and i didnt know how to get it skiding, plus i dont get how the maths works. i understand how Rob does the above.