I have a script for a turret to rotate so it is facing a position, called “Target”. I don’t know how to explain what is happening, so below is the video of what’s going on with my turret.
Video (Google Photos) - Sorry for the music forgot to turn it off
I have it so the turret’s target should always be the red “target indicator” that I have on there, and the turret is only making a 180 degree rotation clockwise and nothing else… Here’s the rotating script
GameObject LookAtCalculations = transform.Find("TurretRotating").gameObject;
LookAtCalculations.transform.position = transform.position;
LookAtCalculations.transform.LookAt(TargetPosition, Vector3.up);
Quaternion GoalRotation = LookAtCalculations.transform.rotation;
GoalRotation.x = 0;
GoalRotation.z = 0;
GoalRotation.w = 0;
transform.rotation = Quaternion.RotateTowards(transform.rotation, GoalRotation, TurretSpeed * Time.deltaTime);
I have no idea what’s happening and how to make the turret simply look at the target, or where the player is aiming, so any and all help appreciated.