GameSalad

Formula to obtain player speed for diagonal move?

mhedgesmhedges Raised on VCSPosts: 631Member, PRO

Hello -

How do I obtain the player's (or any other object, for that matter) speed when moving diagonally? I believe it has to use linear velocity for x and y, but I can't figure out how they are used in a formula.

Thanks, regards.

Comments

  • mhedgesmhedges Raised on VCS Posts: 631Member, PRO
    edited July 17

    Nevermind.

    a2 + b2 = c2

    or

    ObjectSpeed = sqrt( LinearVelocityXˆ2 + LinearVelocityYˆ2 )

  • Two.ETwo.E Posts: 234Member, BASIC

    Or, you could use the Magnitude function.
    I think that would give the same result.

    Best,

Sign In or Register to comment.