Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LookAtScript : MonoBehaviour
- {
- public Transform target;
- void Update() {
- //object looks at whatever is attached to target
- Vector3 relativePos = target.position - transform.position;
- transform.rotation = Quaternion.LookRotation(relativePos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement