Posted: 28th Aug 2011 11:01
Hello,

Wondering if somebody could tell me how to apply an impulse to a rotated sprite so that it moves in the direction it is pointing? How do you calculate where the impulse is suppose to originate from?

Thanks
Posted: 28th Aug 2011 21:43
I took out some of my variable names but this is what works for me
+ Code Snippet
if INITIAL_ANGLE => 0
            x# = - sin(INITIAL_ANGLE)
        else
            x# = sin(INITIAL_ANGLE)
        endif

        y# = cos(INITIAL_ANGLE)
  
        SetSpritePhysicsImpulse(sprite#, GetSpriteXByOffset(sprite#), GetSpriteYByOffset(sprite#), x# * velocity, y# * velocity)


Don't want to give you everything I did, but I will tell you I ended up tweaking the velocity values for x and y differently.