Back to Parent

//Code sample of boat movement
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Circle : MonoBehaviour {

     private float RotateSpeed = 0.06f;
     private float Radius = 700f;
 
     private Vector3 _centre;
	private Quaternion _centrot;
     private float _angle;
 
     private void Start()
     {
         _centre = transform.position;
         _centrot = transform.rotation;
     }
 
     private void Update()
     {
 
         _angle += RotateSpeed * Time.deltaTime;
 
         Vector3 offset = new Vector3(Mathf.Sin(_angle), 0,Mathf.Cos(_angle)) * Radius;
         transform.position = _centre + offset;
		 transform.Rotate(new Vector3(0,(RotateSpeed/(Mathf.PI/180)),0) * Time.deltaTime,Space.World);
     }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0