I need a realistic car turning engine for a physics engine I'm tweaking for one of my games. When the arrows are pressed, it changes a turn velocity and stuff. I have a script for the speed as well, changing when the arrows are pressed. For the turning, I've tried to make it just turn the turn velocity degrees, but then that means you could turn the car when it's stopped, which is wrong. I've tried to make it turn turn velocity / (50 - speed) which means the higher the speed, the more it turns, which means it doesn't turn when it's stopped, but it does when you're driving, but that didn't work either.
I just need a realistic turn engine, and everything I've tried doesn't work. I'll credit the person who can find a good engine in the game. Thanks
Offline
if your just turning by velocity degrees (like the script below, right?), then with a velocity of zero, you wouldn't be able to turn, so how can you turn when you're stopped? Is there a difference between the speed and velocity variables?
turn cw (velocity) degrees
Offline
Here's a first, quite simple attempt:
http://scratch.mit.edu/projects/JSOlabs/2461801
It works, but you can make really sharp turns also when driving fast which is kind of odd. Maybe I can still fix that.
Offline
MoreGamesNow wrote:
if your just turning by velocity degrees (like the script below, right?), then with a velocity of zero, you wouldn't be able to turn, so how can you turn when you're stopped? Is there a difference between the speed and velocity variables?
turn cw (velocity) degrees
I'm trying to make it turn depending on the speed, so that if the car is going faster it turns in a wider circle, and if it's going slower it turns in a tighter circle, but doesn't turn when stopped. So yes, there is a difference between the speed and turn velocity variables.
Offline
JSO wrote:
challenge accepted
Let me try and do some experimenting.
Thanks
Offline
northmeister wrote:
MoreGamesNow wrote:
if your just turning by velocity degrees (like the script below, right?), then with a velocity of zero, you wouldn't be able to turn, so how can you turn when you're stopped? Is there a difference between the speed and velocity variables?
turn cw (velocity) degreesI'm trying to make it turn depending on the speed, so that if the car is going faster it turns in a wider circle, and if it's going slower it turns in a tighter circle, but doesn't turn when stopped. So yes, there is a difference between the speed and turn velocity variables.
Ah, I understand now. In one of my projects, I did something similar using this:
turn cw ((12)/([sqrt v] of (speed))) degreesAre you looking for a formula like that?
Offline
MoreGamesNow wrote:
northmeister wrote:
MoreGamesNow wrote:
if your just turning by velocity degrees (like the script below, right?), then with a velocity of zero, you wouldn't be able to turn, so how can you turn when you're stopped? Is there a difference between the speed and velocity variables?
turn cw (velocity) degreesI'm trying to make it turn depending on the speed, so that if the car is going faster it turns in a wider circle, and if it's going slower it turns in a tighter circle, but doesn't turn when stopped. So yes, there is a difference between the speed and turn velocity variables.
Ah, I understand now. In one of my projects, I did something similar using this:
turn cw ((12)/([sqrt v] of (speed))) degreesAre you looking for a formula like that?
That looks good, but I need the 'turn velocity' variable in there somewhere
Last edited by northmeister (2012-04-11 15:48:22)
Offline
northmeister wrote:
MoreGamesNow wrote:
Ah, I understand now. In one of my projects, I did something similar using this:
turn cw ((12)/([sqrt v] of (speed))) degreesAre you looking for a formula like that?That looks good, but I need the 'turn velocity' variable in there somewhere
set [turn velocity v] to ((12)/([sqrt v] of (speed))) turn cw (turn velocity) degreesHows that?
Offline
MoreGamesNow wrote:
northmeister wrote:
MoreGamesNow wrote:
Ah, I understand now. In one of my projects, I did something similar using this:
turn cw ((12)/([sqrt v] of (speed))) degreesAre you looking for a formula like that?That looks good, but I need the 'turn velocity' variable in there somewhere
set [turn velocity v] to ((12)/([sqrt v] of (speed))) turn cw (turn velocity) degreesHows that?
That looks really good I think I have mine almost figured out, if I get stuck again I'll probably use yours or/and JSO's
Offline
northmeister wrote:
That looks really good I think I have mine almost figured out, if I get stuck again I'll probably use yours or/and JSO's
Oops, that's probably not what you're looking for after all, sorry (when you travel slowly, your turning speed speeds up. When you're not moving, you can turn "12/0" degrees x(. This one should work xD
set [turn velocity v] to ((2) * ([sqrt v] of (speed)))
Offline
MoreGamesNow wrote:
northmeister wrote:
That looks really good I think I have mine almost figured out, if I get stuck again I'll probably use yours or/and JSO's
Oops, that's probably not what you're looking for after all, sorry (when you travel slowly, your turning speed speeds up. When you're not moving, you can turn "12/0" degrees x(. This one should work xD
set [turn velocity v] to ((2) * ([sqrt v] of (speed)))
Ok, the new one looks similar to one I used already
Offline