Hot answers tagged

2

The method you are looking for is Quaternion.LookRotation. First you need to calculate the relative vector between player and tank. You do that by simply subtracting the position of the tank from the position of the player. Then you use Quaternion.LookRotatation to create a rotation into that direction. Vector3 playerDirection = player.transform.position - ...


1

This is the while loop above redone. Kind of ugly and repetitive but it works. I had to use Math.floor and Math.ceil to solve the collision issues which is due to precision I guess. Any spare dt left over if the action sequence is finished is discarded so that might be something to save for accuracy but the timesteps are really small so it may not be ...



Only top voted, non community-wiki answers of a minimum length are eligible