I want my actor to move in a circular path
blackmoroi
Member Posts: 28
Hii,
I want my main actor to move in a circular path, like if left side of the screen is pressed actor should move in a clock wise circular path and vice versa. Pls help me....
thanks
Comments
The easiest /most flexible way to do this would be to use a separate controller actor.
Make a 'controller' actor, throw it into the scene somewhere, it can be invisible or off to one side so you don't see it, or even make its dimensions 0,0 . . . etc etc . . . basically you don't need to see it in the actual game.
Set up a rule where your left and right screen presses rotate this controller actor. For example . . . (landscape iPad screen sizes used) . . .
When mouse button down
--When mouse X position > 512
----Rotate CW
--Otherwise
----Rotate CCW
Ok, so now you have a little controller actor that rotates CW or CCW depending on which side of the screen you press.
Now in your main actor, the one you want to move in a circular path, give it these three behaviours . . .
Constrain X to Radius *cos(controller's rotation)+main actor's X centre
Constrain Y to Radius *sin(controller's rotation)+main actor's Y centre
Constrain Rotation to controller's rotation
How's this?
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
example file attached . . . click/touch left or right to move . . .
thanks for the reply, This is what i need but my actor should move in a straight path if we are not pressing on the screen. To be more specific the actor should follow a tangential path when screen is not pressed. Pls help me
http://images.tutorvista.com/cms/images/83/tangential-acceleration-image.png
Lol.
move
direction 0 relative to actor
speed 300 or whatever
if mouse button is down
rotate clockwise
speed 200 or whatever
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮