1234567891011121314151617181920212223242526 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TestAngle : MonoBehaviour
- {
- public Transform target;
- public Transform thiss;
- private void Update()
- {
- Vector3 target_pos = target.position;
- Vector3 my_pos = thiss.transform.position;
- Vector3 from = Vector3.forward;
- Vector3 to = target_pos - my_pos;
-
- Quaternion rot = Quaternion.FromToRotation(from, to);
-
-
- ; thiss.transform.rotation = rot;
- }
- }
|