public void AimAt(Transform target) { this.transform.LookAt(target.position, this.transform.up); if (this.rotationLimit == null) { this.rotationLimit = this.transform.GetComponent <RotationLimit>(); this.rotationLimit.Disable(); } this.rotationLimit.Apply(); }
private RotationLimit rotationLimit; // The Rotation Limit component #endregion Fields #region Methods // Aim this part at the target public void AimAt(Transform target) { transform.LookAt(target.position, transform.up); // Finding the Rotation Limit if (rotationLimit == null) { rotationLimit = transform.GetComponent<RotationLimit>(); rotationLimit.Disable(); } // Apply rotation limits rotationLimit.Apply(); }
private RotationLimit rotationLimit; // The Rotation Limit component // Aim this part at the target public void AimAt(Transform target) { transform.LookAt(target.position, transform.up); // Finding the Rotation Limit if (rotationLimit == null) { rotationLimit = transform.GetComponent <RotationLimit>(); rotationLimit.Disable(); } // Apply rotation limits rotationLimit.Apply(); }