- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class WhaleBehaviour : MonoBehaviour
- {
- public float rotationSpeed;
- public Vector3 rotationAxis;
- public GameObject rotationPoint;
- private Vector3 perpendicular;
- [SerializeField]
- private PerpendicularVector pv;
-
- void Start()
- {
-
- }
-
- void Update()
- {
-
- transform.RotateAround(rotationPoint.transform.position, rotationAxis, rotationSpeed * Time.deltaTime);
- Vector3 newPos = transform.position + (pv.WhalePerpendicular(true).normalized * 2);
- transform.LookAt(newPos);
-
- }
-
- }