mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-27 03:53:01 +00:00
2ca9cbbb1d
First Contact - Fixed a bug Tap Trial - All anims and input are implemented Air Rally - Initialization
27 lines
697 B
C#
27 lines
697 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CircularMotion : MonoBehaviour
|
|
{
|
|
[SerializeField] float timeCounter = 0;
|
|
[SerializeField] Transform rootPos;
|
|
[SerializeField] float speed;
|
|
[SerializeField] float width;
|
|
[SerializeField] float height;
|
|
|
|
private void Start()
|
|
{
|
|
timeCounter = 0;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
timeCounter += Time.deltaTime * speed;
|
|
float x = Mathf.Cos(timeCounter) * width + rootPos.position.x;
|
|
float y = Mathf.Sin(timeCounter) * height + rootPos.position.y;
|
|
float z = rootPos.position.z;
|
|
|
|
transform.position = new Vector3(x, y, z);
|
|
}
|
|
}
|