Constrain rotation
I know this question keeps coming up and I promise I've read the previous threads I could find on this. I have an actor that has self.rotation=0 and when touch is pressed rotate clockwise at speed 50. When you stop pressing on the actor, I have it interpolate self.rotation back to 0. So it basically swings clockwise, with self.rotation being either 360-->310 or 0-->-50. I want the player to only be able to swing the actor 50 degrees (to 310 or -50). But when I try to constrain with min/max, it doesn't work.
Is there a way to do this?
Is there a way to do this?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Best Answer
-
Photics Posts: 4,172
I think rules might be the way to go...
If touch is pressed
---new rule with "All" selected...
---self.rotation is greater than or equal to -50
---and less than or equal to 0
---rotate clockwise
---new rule with "All" selected...
---self.rotation is greater than 310
---and rotation is less than or equal to 360
---rotate clockwise
Otherwise rotate to 0
I didn't use interpolate. I just used the "Rotate" and "Rotate to Angle" behaviors.
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User