I’m working on a 2d overhead space shooter, and I’ve got all my tilting looking good on the player ship (I know, I know, real physics in space wouldn’t tilt). The problem I’m having is the enemy ships. I have them chase the player using the default SmoothLookAt script and constantforce within a certain radius.
How can I convert the SmoothLookAt angle to a z-axis rotation that rights itself as the angle decreases between the enemy ship and the player? I’ve tried a heap of potential solutions, but can’t seem to get it right.
Right now I’m trying to do it this way (with the parent GO using the SmoothLookAt script):
Well, I (personally) didn’t answer initially because I wasn’t really clear on what type of behavior you’re trying to implement (and I’m still not quite clear on that).
Basically we’re looking down on our ships, and they rotate to face their target. I want them to tilt on the z-axis as if they are banking toward their target, and right themselves as the angle decreases. I’ve got it working that way at the moment, but with this method it just snaps to the deepest bank possible (45 degrees), then recovers. What I’d like is for it to ease in, then ease back.