car turning/speed ratio

Started by
3 comments, last by redmonkey 23 years, 2 months ago
ive just added gears, and proper truning to my game, but i havent added any proper turning ratio''s, ie: i still turn whilst at 0 speed rather than use very-realistic speeds, i want a more action based turning, as its a very fast action game, and its a top-down style game i decided the best course is a larger turning circle at high/full speed, and a small turning circle when accelerating quickly. the problem with a simple formula is that moving at a very very small speed (or stopped) turning would be fast... the current used variables include, my steering angle, the velocity, and revs for the car, (whcih affect the velocity by gears etc) can anyone explain a good method? or suggest something? __________________ graham "red" reeves. red@deadpenguin.org www.deadpenguin.org
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org
Advertisement
Don't solely rely on the speed factor to determine your turns.
I can make the same kind of turn in a car regardless of what speed I'm going, it just matters when and how I turn the wheel.

But then again, you can't press a "left turn" or "right turn" key down harder to simulate how hard you'd like to turn

So assuming your programming for a keyboard and not a wheel-joystick, this is what my guesses are..

Have the speed of your turn be determined by the speed your car, using whatever which formula you create, and have the arc of your turn be determined by the distance your car is travelling in a second. In other words, clock the distance you travel between every second, if you've moved considerably far, have the turn of your car be larger, if the distance is smaller, have the immediate turn be larger.

So if your speed is 0 then your car would not turn at all, because the car is not moving. If your car is at 0 mph, and you turn your steering wheel, your car's wheels will turn, not the car, until the car is moving.

In the same respect, if your car goes 10 mph, it would turn slowly but in a smaller radius.

If I made any sense I hope it helped :/

Edited by - sinful on January 29, 2001 6:10:18 PM
You can try to simulate the amount of turn using a keyboard.

The longer the user holds the key down the more "turn" he/she can do... until he gets to full lock of the steering wheel.
Regards,Nekosion
Hello Graham,

Fix the turning circle with respect to steering input, this is the correct thing to do. A lot of games limit the ammount of steering lock that is available at high-speed, this helps make the car a bit more stable, but not too helpful for a rally-driving sim, or in extreme condiditons when a player might need to apply full opposite lock during a 150mph slide!

All the best.

Matt



i already ahve the steering lock code in place (thanks matt :])

but i have a kind of mix between my old code, and good code; my car has an angle (for render, future movement) a steering lock (bad name, its the "value" of my steering wheel pos) the revs.

my speed/velocity has already been calculated by the revs etc, but my angle needs work (this will be the final angle, after the world tick)

current code:
		if (sprite.speed!=0.0f)			sprite.angle-=sprite.steeringlock/(28/sprite.speed);<br>//			sprite.angle-=sprite.steeringlock/(28/sprite.speed);<br><br><br>		//sprite.speed=newspeed;<br>		if (sprite.speed!=0.0f)<br>		{<br>			sprite.x+=float(cosx[(byte)sprite.angle]*(sprite.speed/10));<br>			sprite.y+=float(sinx[(byte)sprite.angle]*(sprite.speed/10));<br>		}<br></pre><br><br>thats kinda the main bit of code there (thats relative) if anyoene wants to help me further, ill happily upload/send new code (its kidna open source until i get a funding/publishing deal :D)  </i>   <br><br>__________________<br>graham "red" reeves.<br><br><a href="mailto:red@deadpenguin.org">red@deadpenguin.org</a><br><a href="http://www.deadpenguin.org">www.deadpenguin.org</a>    
__________________graham "red" reeves.[email=red@deadpenguin.org]red@deadpenguin.org[/email]www.deadpenguin.org

This topic is closed to new replies.

Advertisement