mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 09:16:08 +07:00
physics wip
This commit is contained in:
25
Assets/IsoTools/Examples/Scripts/CircleFly.cs
Normal file
25
Assets/IsoTools/Examples/Scripts/CircleFly.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace IsoTools { namespace Examples {
|
||||
public class CircleFly : MonoBehaviour {
|
||||
public float FlyRadius = 150.0f;
|
||||
public float FlySpeed = 1.0f;
|
||||
|
||||
Vector3 _start_pos;
|
||||
float _fly_timer;
|
||||
|
||||
void Start() {
|
||||
_start_pos = transform.position;
|
||||
_fly_timer = 0.0f;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
_fly_timer += FlySpeed * Time.deltaTime;
|
||||
transform.position = new Vector3(
|
||||
_start_pos.x + Mathf.Cos(_fly_timer) * FlyRadius,
|
||||
_start_pos.y + Mathf.Sin(_fly_timer) * FlyRadius,
|
||||
_start_pos.z);
|
||||
}
|
||||
}
|
||||
}} // namespace IsoTools::Examples
|
||||
Reference in New Issue
Block a user