Version: 2023.1
言語: 日本語
public Vector3 axisOfRotation ;

説明

Mesh particles rotate around this axis.

Mesh particles travel around an axis set up for each particle.

using UnityEngine;

[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { public bool overrideAxisOfRotation; private ParticleSystem ps;

void Start() { ps = GetComponent<ParticleSystem>(); }

void Update() { if (overrideAxisOfRotation) { ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount]; ps.GetParticles(particles);

for (int i = 0; i < particles.Length; i++) particles[i].axisOfRotation = Vector3.up;

ps.SetParticles(particles, ps.particleCount); } }

private void OnGUI() { bool newValue = GUI.Toggle(new Rect(10, 10, 200, 30), overrideAxisOfRotation, new GUIContent("Override Axis of Rotation")); if (newValue != overrideAxisOfRotation) { ps.Clear(); overrideAxisOfRotation = newValue; } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961