mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-03-23 02:44:37 -05:00
41 lines
892 B
C#
41 lines
892 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace VRM.SimpleViewer
|
|
{
|
|
public class TargetMover : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
float m_radius = 5.0f;
|
|
|
|
[SerializeField]
|
|
float m_angularVelocity = 40.0f;
|
|
|
|
[SerializeField]
|
|
float m_y = 1.5f;
|
|
|
|
[SerializeField]
|
|
float m_height = 3.0f;
|
|
|
|
public IEnumerator Start()
|
|
{
|
|
var angle = 0.0f;
|
|
|
|
while (true)
|
|
{
|
|
angle += m_angularVelocity * Time.deltaTime * Mathf.Deg2Rad;
|
|
|
|
var x = Mathf.Cos(angle) * m_radius;
|
|
var z = Mathf.Sin(angle) * m_radius;
|
|
var y = m_y + m_height * Mathf.Cos(angle / 3);
|
|
|
|
transform.localPosition = new Vector3(x, y, z);
|
|
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
}
|