ShortestRotationModifier

  ... the case you feel the need for a new feature or want to submit one.

ShortestRotationModifier

Postby kelton5020 » Wed Dec 08, 2010 4:41 pm

I think you should make a ShortestRotationModifer, basically so you can do this...
sprite.addShapeModifier(new ShortestRotationModifier(2f,355f,2f));
and not have it spin all the way around the long way. I've looked through the base classes of rotationmodifier and I don't think I understand your code enough(so many extends and impliments) to be able to develop it myself without spending a lengthy amount of time figuring it out. I know a lot of people would like this.
Consider this
http://stackoverflow.com/questions/1048945/getting-the-computer-to-realise-360-degrees-0-degrees-rotating-a-gun-turret/1049214#1049214
kelton5020
 
Posts: 21
Joined: Tue Nov 23, 2010 8:04 am

Re: ShortestRotationModifier

Postby turnA » Thu Dec 09, 2010 2:04 am

Yes, it should be simple to implement.
Alternatively, you can calculate it by yourself before adding RotationModifier:

var dif:Number = (targetRotation - curRotation) % 360;
if (dif != dif % 180)
{
dif = (dif < 0) ? dif + 360 : dif - 360;
}
targetRotation = curRotation + dif;

sprite.addShapeModifier(new RotationModifier(period,curRotation,targetRotation));
turnA
 
Posts: 16
Joined: Fri Oct 15, 2010 4:30 pm


Return to Features

Who is online

Users browsing this forum: No registered users and 5 guests