|
-
Jan 12th, 2003, 08:56 AM
#1
Physics int the math forum... :)
OK, don't ban me for asking a physics question here. But I guess that those who is good in math are also good in physics. At least in most cases.
OK, I have this car game. And I'm not that good with car motions. I know that if you drive a car to fast and are trying to turn the car will continue straight forward. And I can calculate this. But if the car has next to zero speed then what happens to the turning. If it turns just as fast as it always does. It looks like it is just turning around it's own axis. Anyone know how to calculate how much the car can turn if it has next to zero speed forward. Or at least any idea how to fix this????
-
Jan 12th, 2003, 09:22 AM
#2
Fanatic Member
First off, people have asked physics questions here before.. as well as many other topics which aren't really math..
I would assume (I haven't taken physics in school yet) that you would use teh vehicles force.. and "push" it while decelerating that force.. err here's some code
VB Code:
speed as single, Pspeed as single, direction as single, Pdirection as single, x as single, y as single
' strolling down teh street weeeee
car.X = car.x + speed * sin(direction*3.14/180)
car.y = car.y + speed * cos(direction*3.14/180)
'if the car changed course, make it move in the direction it was going for a bit...
if Pdirection = direction then
Pspeed = speed
else
car.X = car.x + Pspeed * sin(Pdirection*3.14/180)
car.y = car.y + Pspeed * cos(Pdirection*3.14/180)
Pspeed = Pspeed - 1
end if
Of course this is NOT a very accurate representation of physics, as the curve would be pushing you out at all times.. and not in the same direction, but this is a start.
Don't pay attention to this signature, it's contradictory.
-
Jan 12th, 2003, 09:27 AM
#3
Thanks but I can't see that this is helping me with the car having a next to zero speed, and what to do with the turning then. Or am I not understnading what you are talking about....
if what you did is right, can you then comment the wariables a bit...I don't understand what you meen by the "p"....
-
Jan 12th, 2003, 09:51 AM
#4
Fanatic Member
I said it was just an example.
I don't know how forces work (as I said) but would the force to the outside of a curb be speed*degrees/sec ??
Pspeed holds your momentum, Pdirection holds where momentum is focused, too bad with that code it would only work on the first curve.
It's all just logical things I guess at which CAN look like the real thing. (Grand tourismo 1, 160 MpH= something more like 50 KpH)
http://www.vbforums.com/showthread.p...hreadid=223368
A post on physics that looks similar to this.. (or you could just scroll down about 5 spots )
Don't pay attention to this signature, it's contradictory.
-
Jan 12th, 2003, 10:17 AM
#5
Thanks but I don't think that post is going to answer my question. I'm not sure if it is a physics question at all, it might be jsut the some code tricks that has to be done. To make it look real. I think I will try to play GTA1 now and see what I can learn...
-
Jan 14th, 2003, 07:42 AM
#6
To do something like that i think you need to have the following:
The object has a velocity with direction (a vector)
The object has a power to increase the velocity in the present direction of the object.
The object has a turn ability (degrees per time).
Each velocity is decreased at each timestep (resistance , is that english term correct?)
The new velocity after each timestep is calculated as the result of the old velocity vector minus resistance plus power vector.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jan 14th, 2003, 10:08 AM
#7
Thanks Opus...but I found this now...and I think it can explain everything I want about cars and more then that...
Car physics
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|