Rotate actor around another actor, pointing at mouse

FangFang Member Posts: 33
edited November -1 in Working with GS (Mac)
Hello, it's me again! ( D: )

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

  • DrGlickertDrGlickert Member Posts: 1,135
    you could try;

    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?
  • FangFang Member Posts: 33
    Sorry, but that's not what I'm looking for, though that can be used to give the attack the right rotation.
    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.
  • DrGlickertDrGlickert Member Posts: 1,135
    Still a little confused about what exactly you want to do, but I'd suggest that you do a search on the creator main page under the "New" section, do a search for Rotation and it'll bring up a few projects.

    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
  • FangFang Member Posts: 33
    Mr. Ninja Style Game Fixed seems to have what I need. I'll mess around with that for a bit, thanks!

    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.
Sign In or Register to comment.