Rotate on MouseClick?
Ing3nu
Member Posts: 22
Happy Weekend Everybody!
I am trying to get my box (which now has passable holes, thanks to JackBQuick and EAguirre) to rotate 90deg when it receives a mouseclick or touch.
Thus far I am having no luck. I have placed a rule that first defines "on touch" and then a "rotate to position" in the box actor but it does not seem to function when I try it out in the preview.
So my first question is, should the rule be in the actor itself (the box is created by having a procedural actor spawn 6 small "pips") or should it be more general and elsewhere in the scene?
My second question is, do I need to have more to it than just a rule defining the touch and the rotation? For example so I need to add some sort of rotation constraint?
Any examples or advice are welcome!
I am trying to get my box (which now has passable holes, thanks to JackBQuick and EAguirre) to rotate 90deg when it receives a mouseclick or touch.
Thus far I am having no luck. I have placed a rule that first defines "on touch" and then a "rotate to position" in the box actor but it does not seem to function when I try it out in the preview.
So my first question is, should the rule be in the actor itself (the box is created by having a procedural actor spawn 6 small "pips") or should it be more general and elsewhere in the scene?
My second question is, do I need to have more to it than just a rule defining the touch and the rotation? For example so I need to add some sort of rotation constraint?
Any examples or advice are welcome!
Comments
Try Rotate to Angle instead.
In the Box Actor, try this Rule:
Rule
When all conditions are valid:
Touch is Pressed
-----Rotate To Angle: self.Rotation + 90
That SHOULD work. Let us know if it doesn't.
Here's a quick demo - I think it may be what you're after.
http://gamesalad.com/game/play/82153
Hope it helps,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
This is almost exactly what I need. The problem seems to be that the actor in mine also spawns six little boxes used for collision. The boxes will not rotate with the actor, they stay in the position they were spawned at.
Any ideas?
y=sin(angle)*radius+yOffset
x and y are position? or should I add game attributes
http://gamesalad.com/game/play/82217
Orbz, I've tried working with the expressions you gave me, but they seem to lock up the object rotation.
http://gamesalad.com/game/play/82217
Rotating Tunnel (Demo)
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io