Making actor face target (homing target)
Alano
Member, PRO Posts: 70
Hey all, so I have "enemy" actors homing in on my hero actor (think swarming bees). Right it's just blocks but when I added a graphic I see the enemy actor stuck facing to the right and NOT facing the target Hero actor they are moving towards. Example, when a missile shoots up in the sky and then falls down the nose cone always faces forward. In my case the enemies are traveling in from various directions and not just right to left, up to down.
Q: I know this is basic but how do I get the my actors to face the direct they are moving.
Thanks for the help!
Alan
Comments
I am just taking a stab as I haven't tried to do this. Create two game level attributes and constrain them to the X and Y position coordinates in the Hero actor. Then use these attributes and the Rotate to Position behaviour in the enemy actor and see if you can get that to work.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Hey thanks Colander. Unfortunately I'm still kinda new to GS. Do you mean to set "self.position.X and self.position.Y?"
-Alan
Yes create your Game level attribute of type Real (i.e. "heroPosX" or whatever you want to call it) and in the Hero actor, use Constrain and "game.heroPosX To self.Position.X"
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Hey thanks Colander!
So I created that but no change. Perhaps I need a different tweak. More description of what I have:
Any advice would be greatly appreciated!
-Alan
Try this in the spawned enemy actors: