How to find the speed of an actor?

ericdg123ericdg123 Member, PRO Posts: 156
edited November -1 in Working with GS (Mac)
I'm just not figuring this out. Where do I find the speed of an actor? I can find the x and y speed but how do I find out the total speed in any direction? What I'm trying to do is have a speed variable so I can use that to change the pitch of sounds based on the speed of an actor.

Thanks.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi ericdg123

    Few thoughts came to mind here (thinking out loud, as it were): if you want the pitch of the sound to change based on the speed of the Actor, then total speed isn't relevant. It'd be based on the variable speed (speed at any point using Acceleration), which would be different moment by moment. So, you'd need an integer attribute, called SpeedAtThisMoment perhaps, which would be updated regularly with a timer. (how you'd do that, I'm not sure yet; perhaps another Forum member can chime in there).

    Then in your Rules somewhere, I guess you need Play Sound set to looped, the pitch set to SpeedAtThisMoment.

    This might not be completely there, but it's in the the ballpark, as it were, I think; hope it gives you a few leads to solve it at least.

    :-)

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I'm pretty sure you need to use Pythagorean theorem

    square root of (linearX^2 + linearY^2)
  • jstrahanjstrahan Member Posts: 498
    You could alway start ur game and a stopwatch ten run next to the computer at the same speed as ur actor then calculate ur speed and use that number or maybe that's the sleep talking
  • ericdg123ericdg123 Member, PRO Posts: 156
    Thx for the suggestions. What I'm trying to do is make an engine sound change pitch depending how fast the car is going. I'll try that formula scitunes.
Sign In or Register to comment.