Results 1 to 7 of 7

Thread: Physics int the math forum... :)

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    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????

  2. #2
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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:
    1. speed as single, Pspeed as single, direction as single, Pdirection as single, x as single, y as single
    2.  
    3. ' strolling down teh street weeeee
    4. car.X = car.x + speed * sin(direction*3.14/180)
    5. car.y = car.y + speed * cos(direction*3.14/180)
    6.  
    7. 'if the car changed course, make it move in the direction it was going for a bit...
    8. if Pdirection = direction then
    9. Pspeed = speed
    10. else
    11. car.X = car.x + Pspeed * sin(Pdirection*3.14/180)
    12. car.y = car.y + Pspeed * cos(Pdirection*3.14/180)
    13. Pspeed = Pspeed - 1
    14. 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.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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"....

  4. #4
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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.

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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...

  6. #6
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    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!

  7. #7

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    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
  •  



Click Here to Expand Forum to Full Width