Results 1 to 10 of 10

Thread: Function question...(resolved)...

  1. #1

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

    Function question...(resolved)...

    I'm making a car game, and I need to find a function for the acceleration of the car. I want the acceleration to be 0.2 when the speed is close to zero and the acceleration to be close to 0 when the speed is close to 10....anyone???



    The function should make a graf that looks like the picture. Something like an Ln function or something like that. ANyone know how to do that???
    Attached Images Attached Images  
    Last edited by NoteMe; Jan 11th, 2003 at 08:52 PM.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    something like this maybe
    a(v)=0.2-ln(v/10*(e-1)+1)*0.2
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by kedaman
    something like this maybe
    a(v)=0.2-ln(v/10*(e-1)+1)*0.2
    I tried your function, but it looks like the speed is close to zero the acceleration is more then 9. I wan it to be 0.2. Am I doing something wrong or, was you function fault????

  4. #4

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

    Y(X)=0.1 - 0.1log X



    I was only looking at the ln function, but actually the LOG function was bether....

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    No this is totaly wrong...forget this for a moment...I have to rethink my question....

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Forget the whole thing. Thanks for trying to help me out. But the answer was something like:

    Acceleration = 0.23 - (0.1 * Log(Speed))

    so I'm not sure what I was doing...


    BTW: How do I use e(the natural number) and ln in VB code?????????

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    base convertion a to b
    log x(b) =log a(x)/log a(b)

    in vb to get ln(x) you have log(x)/log(e)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Thanks, that was actuall something that I didn't remember from math...but thanks anyway...

  9. #9
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    trig

    You could use a trigonometric function.

    'cos(0) = 1 cos(90) = 0 right??

    Accel = cos(currentspeed/maxspeed)*maxaccel

    im not sure if that woudl work as I haven't thought over it much/tv going in background

    mentos mentos mentos.. sorry
    Don't pay attention to this signature, it's contradictory.

  10. #10

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I don't think I can use Cos or Sin , because they only make perfect waves, if you see my pic at the top, it is a Ln/log graf.

    BTW I did, put a Resolved tag at the thead, because the game is working OK now. So you can consentrate on the TV instead...

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