I’m working on a project which combines 3D models with 2D sprites. Here’s a screenshot so you can get an idea of what I’m talking about: http://i.imgur.com/hNqvZ9r.png
Basically what I’m looking to do is rotate the turret sprites to aim at targets within the environment. The sprite is all split up and I can rotate it around in the editor (http://i.imgur.com/n925TG2.png). Problem is, I want to replicate the behavior through code, and I’m not sure how. I need to isolate the 2D point on the camera field for both the turret and the target, find the rotation value between the two points, multiply the X scale by -1 if the target is to the left of the turret (So it doesn’t rotate upside down) and rotate the tower so it all looks right. Most of that sounds pretty reasonable, I’m just getting stuck on the 3D to 2D point projection.
Is there a good function or method in Unity to do this? I have a few visual effects that rely on being able to do that conversion very easily, so if there’s something built into the engine, that would be awesome.