My project is in 2D so I am using my own player controller and animation system. When I talk to an NPC, I would like to set their animator to face the player, similar to how it's supported in 3D. However, since it's in 2D, a new animation sprite needs to be played instead of a simple game object rotation.
To do this I can calculate the x and y distance between the player and the NPC. Then, depending on which is greater, and if the distance is positive or negative, I can set the NPC to face 1 of 4 directions.
The only thing is, I'm not sure how I can do this in ORK. This calculation seems to be too complex for the editor's event system, so is there a way I can put this in the scripts? What would I need to do to go about that?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Since my game is in 2D, the characters only move on the X and Y planes. I could get check orientation to correctly detect when I was to the left and right of them, but not to the front/back (more accurately repurposed as below/above in 2D). I tested in the editor and changing the Z values which made it trigger right.
Hm, maybe I could write a script that changes each object's Z value based on their position on camera. I already use something like that for rendering.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!