您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

22 行
612 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FloatingRig : MonoBehaviour
{
public Vector3 Frequency = new Vector3(4,5,6);
public Vector3 Amplitude = new Vector3(0.0f, 0.2f, 0.0f);
Vector3 m_InitialPosition;
private void Awake()
{
m_InitialPosition = transform.position;
}
private void Update()
{
float t = Time.time;
transform.position = m_InitialPosition + new Vector3(Mathf.Sin(t * Frequency.x) * Amplitude.x, Mathf.Sin(t * Frequency.y) * Amplitude.y, Mathf.Sin(t * Frequency.z) * Amplitude.z);
}
}