Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / NPC / WhaleBehaviour.cs
@Rackday Rackday on 21 Aug 807 bytes Project Added
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;
    // Start is called before the first frame update
    void Start()
    {
   
    }

    // Update is called once per frame
    void Update()
    {
        

        transform.RotateAround(rotationPoint.transform.position, rotationAxis, rotationSpeed * Time.deltaTime);
        Vector3 newPos = transform.position + (pv.WhalePerpendicular(true).normalized * 2);
        transform.LookAt(newPos);
        //Debug.DrawRay(transform.position, pv.WhalePerpendicular(false));
    }

    
}