Rotate actor around another actor, pointing at mouse
![Fang](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hello, it's me again! (
)
I have an actor, my Hero. He has an attack that spawns an actor forward, along with some particles (somewhat like fire breath). The attack's actor destroys itself after two seconds.
Problem is, when the actor turns around during the two seconds of the attack, the attack actor stays in place.
So I am in need of a way to rotate the attack actor around the Hero, in such a manner that it heads towards the mouse (the Hero always faces the mouse, if that can be put to use).
I've searched around already, but most of the methods I've found use complicated math, so I can't figure out how to bend it to my needs (no methods I've found involve facing the mouse).
Thanks again,
~ Fang
![D: D:](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/anguished.png)
I have an actor, my Hero. He has an attack that spawns an actor forward, along with some particles (somewhat like fire breath). The attack's actor destroys itself after two seconds.
Problem is, when the actor turns around during the two seconds of the attack, the attack actor stays in place.
So I am in need of a way to rotate the attack actor around the Hero, in such a manner that it heads towards the mouse (the Hero always faces the mouse, if that can be put to use).
I've searched around already, but most of the methods I've found use complicated math, so I can't figure out how to bend it to my needs (no methods I've found involve facing the mouse).
Thanks again,
~ Fang
Comments
Rotate To Position;
X: devices>mouse>position>X
Y: devices>mouse>position>Y
That'll direct the player towards the mouse position.
Is this what you're looking for?
I'm looking for a way to rotate an actor around my Hero if the same way my Hero rotates. Hero turns right, attack orbits to the right around him. So that the attack is always in front of the Hero.
Look through those projects and see if one has what you're looking for. There are a lot about rotation, I'd suggest looking at the called Example Rotations and Mr.Ninja Style Game Fixed
EDIT: Turns out what I used before was correct, I just needed to add something extra in. Works fine now, just need to get it to rotate. (constrain self.rotation to game.heroRotation)
Here's what I did:
For the attack actor:
Constrains attribute self.Position.X to ( cos( game.HeroRotation )*120 ) + game.HeroPosX
Constrains attribute self.Position.Y to ( sin( game.HeroRotation )*120 ) + game.HeroPosY
Hope that helps anyone else who visits here!
EDIT:
Turns out there's a better way to do this than rotating the actor along with it. Derp.