Jump to content

Constant Circular Motion.


kestorr
 Share

Recommended Posts

Hello there.

 

Im trying to add a constant circular motion to a sprite (with no player interraction, the sprite just moves like that), but not sure how.

I have tried angular Velocity but that only rotates the sprite from its center. and not in a radius.

 

How can i do this?

 

 

 

Thanks.

Link to comment
Share on other sites

No problem - this is a fantastic article to learn more about this kind of stuff: http://www.smashingmagazine.com/2011/10/04/quick-look-math-animations-javascript/

 

Be aware that if you want to apply this to a physics-enable sprite, you'll need to set sprite.body.moves = false, which may cause some other problems with physics calculations. You can get a similar circular motion effect by applying this loosely to the body.velocity.x and y properties like in this example: http://jsfiddle.net/lewster32/4sj9n927/2/

 

Be aware though that this isn't as controllable - I'm afraid my maths skills fall a little short here, but I'm sure someone else could improve this :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...