Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

32 行
859 B

using UnityEngine;
namespace BoatAttack
{
public class BoatFoamGenerator : MonoBehaviour
{
public Transform boatTransform;
private ParticleSystem.MainModule _module;
public ParticleSystem ps;
public float waterLevel = 0;
private Vector3 _offset;
private void Start()
{
_module = ps.main;
_offset = transform.localPosition;
}
// Update is called once per frame
private void Update()
{
var pos = boatTransform.TransformPoint(_offset);
pos.y = waterLevel;
transform.position = pos;
var fwd = boatTransform.forward;
fwd.y = 0;
var angle = Vector3.Angle(fwd.normalized, Vector3.forward);
_module.startRotation = angle * Mathf.Deg2Rad;
}
}
}