Jump to content
Search Community

LinePath2D rotation question, in use with Starling.

joshdickens test
Moderator Tag

Recommended Posts

Thanks for the great documentation around LinePath2D, definitely got things up and running quickly.

 

Two quick questions.

 

I have the 'addFollower' autoRotate set to true and when it hits a point it does rotate, but it's an instant rotation. Is there a way to tween this rotation?

 

I'm using this in a Starling game and the rotation needs to be in radians instead of degress. I did some digging and found this line #257 in LinePath2D.as:

pp.angle = Math.atan2(pp.xChange * m.b + pp.yChange * m.d, pp.xChange * m.a + pp.yChange * m.c) * _RAD2DEG;

I removed the '_RAD2DEG' and that seemed to do the trick, as far as correct rotation - is there a better way then this to yield radians?

 

Thanks!

Link to comment
Share on other sites

That's probably the fastest way to get what you're after, yeah. Starling takes a non-standard approach to rotation (using radians rather than degrees) as you discovered but removing that multiplier should give you exactly what you're looking for. And as far as tweening the angle, the only thing I can think of is to add an onUpdate to the tween that runs some custom logic. Maybe it remembers the previous rotation value, reads the new one, and interpolates a value between those based on the progress of your tween, and then don't forget to add a tween in an onComplete to finalize that change for however long you want it to after the tween is done. 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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