Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Increase/decrease car speed (DB Classic)

Author
Message
Retro Addict
20
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 12th Feb 2004 16:33
I'm looking for some help with getting a car to gradually increase and decrease in speed for a more realistic feel. Can someone show me an example of how this is done? I'm also interested in learning how to do moderate sliding/skidding as if you were going around a sharp curve...

PC Specs: AMD 1800+ 256M DDR, Geforce MX440 - DB v1.13

To DB or not to DB............duh DB!
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 13th Feb 2004 02:08
For acceleration, remember this:

acceleration = (final velocity - initial velocity) / time

Then as the player holds or doesn't hold the accelerate button increase or decrease the value by a small amount until you reach the maximum velocity.
When the car turns, make the current velocity go down a bit, because velocity is speed in a single direction, and you're changing directions.

For sliding, I'm not a real expert, but you could try keeping the car moving in the direction it was once facing for a while and slowly decrement it.

good luck,
Crazy Donuts

Juvenile Industries
Current Project: KillZone(FPS)
Soon to come:An rts, and a snowball fight game
Retro Addict
20
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 13th Feb 2004 15:28
Thanks Crazy. I'll keep tinkering with it.

PC Specs: AMD 1800+ 256M DDR, Geforce MX440 - DB v1.13

To DB or not to DB............duh DB!
bibz1st
21
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 14th Feb 2004 13:27
try this.
rob
Fluffy Paul
21
Years of Service
User Offline
Joined: 16th Dec 2002
Location: United Kingdom
Posted: 15th Feb 2004 14:06
Dude - for skidding or sliding you can get away with having the car model turn faster than the direction of travel changes.

E.g. Your car is travelling at 100mph and can't turn faster than 45 degrees per second. Even if the player steers the car to the right so that the model turns faster than this all you need to do is move the car at 45 degrees to it's original direction.

You'll need to change your code to keep track of the direction of travel separately from the direction the car model is pointing at. Using this system you can make a car do realistic moves like a "doughnut" and even a figure-of-eight depending on how responsive your steering is

It's really important that you decide at what speed you want the car to start doing this as it's really unrealistic at low speeds unless the car is doing a wheel-spin.

Ending a sentence with a French word is so passé
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 16th Feb 2004 08:24
Hey, I was just looking around the sin/cos section of db help and I found a little section of commands I've never seen before.

NEWXVALUE() and all the others with Y and Z automatically calculate the following: NewX=OldX+(Radius*sin(Yangle)

There's some others like CurveValue that should simulate the effect you're looking for.

Crazy Donut Productions
Current Project: KillZone
Retro Addict
20
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 17th Feb 2004 01:12
Thanks for all the input guys. This has been very helpful!!

PC Specs: AMD 1800+ 256M DDR, Geforce MX440 - DB v1.13

To DB or not to DB............duh DB!

Login to post a reply

Server time is: 2024-11-26 05:55:27
Your offset time is: 2024-11-26 05:55:27