Legacy Documentation: Version 2018.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ParticleSystem.VelocityOverLifetimeModule.orbitalZ

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var orbitalZ: ParticleSystem.MinMaxCurve;
public ParticleSystem.MinMaxCurve orbitalZ;

Description

Curve to control particle speed based on lifetime, around the Z axis.

#pragma strict
private var ps: ParticleSystem;
public var hSliderValueX: float = 0.0f;
public var hSliderValueY: float = 0.0f;
public var hSliderValueZ: float = 0.0f;
public var hSliderValueRadial: float = 0.0f;
public var hSliderValueOffset: float = 0.0f;
function Start() {
	ps = GetComponent.<ParticleSystem>();
	ps.transform.rotation = Quaternion.identity;
	var main: var = ps.main;
	main.startSpeedMultiplier = 0.0f;
	var shape: var = ps.shape;
	shape.shapeType = ParticleSystemShapeType.Circle;
	shape.radius = 5.0f;
	var velocityOverLifetime: var = ps.velocityOverLifetime;
	velocityOverLifetime.enabled = true;
	var trails: var = ps.trails;
	trails.enabled = true;
	trails.widthOverTrailMultiplier = 0.1f;
	var psr: var = GetComponent.<ParticleSystemRenderer>();
	psr.trailMaterial = psr.material;
}
function Update() {
	var velocityOverLifetime: var = ps.velocityOverLifetime;
	velocityOverLifetime.orbitalXMultiplier = hSliderValueX;
	velocityOverLifetime.orbitalYMultiplier = hSliderValueY;
	velocityOverLifetime.orbitalZMultiplier = hSliderValueZ;
	velocityOverLifetime.radialMultiplier = hSliderValueRadial;
	velocityOverLifetime.orbitalOffsetX = hSliderValueOffset;
}
function OnGUI() {
	GUI.Label(new Rect(25, 40, 100, 30), "X");
	GUI.Label(new Rect(25, 80, 100, 30), "Y");
	GUI.Label(new Rect(25, 120, 100, 30), "Z");
	GUI.Label(new Rect(25, 160, 100, 30), "Radial");
	GUI.Label(new Rect(25, 200, 100, 30), "Offset");
	hSliderValueX = GUI.HorizontalSlider(new Rect(85, 45, 100, 30), hSliderValueX, -5.0f, 5.0f);
	hSliderValueY = GUI.HorizontalSlider(new Rect(85, 85, 100, 30), hSliderValueY, -5.0f, 5.0f);
	hSliderValueZ = GUI.HorizontalSlider(new Rect(85, 125, 100, 30), hSliderValueZ, -5.0f, 5.0f);
	hSliderValueRadial = GUI.HorizontalSlider(new Rect(85, 165, 100, 30), hSliderValueRadial, -2.0f, 2.0f);
	hSliderValueOffset = GUI.HorizontalSlider(new Rect(85, 205, 100, 30), hSliderValueOffset, -5.0f, 5.0f);
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public float hSliderValueX = 0.0f; public float hSliderValueY = 0.0f; public float hSliderValueZ = 0.0f; public float hSliderValueRadial = 0.0f; public float hSliderValueOffset = 0.0f;

void Start() { ps = GetComponent<ParticleSystem>(); ps.transform.rotation = Quaternion.identity;

var main = ps.main; main.startSpeedMultiplier = 0.0f;

var shape = ps.shape; shape.shapeType = ParticleSystemShapeType.Circle; shape.radius = 5.0f;

var velocityOverLifetime = ps.velocityOverLifetime; velocityOverLifetime.enabled = true;

var trails = ps.trails; trails.enabled = true; trails.widthOverTrailMultiplier = 0.1f;

var psr = GetComponent<ParticleSystemRenderer>(); psr.trailMaterial = psr.material; }

void Update() { var velocityOverLifetime = ps.velocityOverLifetime; velocityOverLifetime.orbitalXMultiplier = hSliderValueX; velocityOverLifetime.orbitalYMultiplier = hSliderValueY; velocityOverLifetime.orbitalZMultiplier = hSliderValueZ; velocityOverLifetime.radialMultiplier = hSliderValueRadial; velocityOverLifetime.orbitalOffsetX = hSliderValueOffset; }

void OnGUI() { GUI.Label(new Rect(25, 40, 100, 30), "X"); GUI.Label(new Rect(25, 80, 100, 30), "Y"); GUI.Label(new Rect(25, 120, 100, 30), "Z"); GUI.Label(new Rect(25, 160, 100, 30), "Radial"); GUI.Label(new Rect(25, 200, 100, 30), "Offset");

hSliderValueX = GUI.HorizontalSlider(new Rect(85, 45, 100, 30), hSliderValueX, -5.0f, 5.0f); hSliderValueY = GUI.HorizontalSlider(new Rect(85, 85, 100, 30), hSliderValueY, -5.0f, 5.0f); hSliderValueZ = GUI.HorizontalSlider(new Rect(85, 125, 100, 30), hSliderValueZ, -5.0f, 5.0f); hSliderValueRadial = GUI.HorizontalSlider(new Rect(85, 165, 100, 30), hSliderValueRadial, -2.0f, 2.0f); hSliderValueOffset = GUI.HorizontalSlider(new Rect(85, 205, 100, 30), hSliderValueOffset, -5.0f, 5.0f); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答