ParticleSystemRenderer.normalDirection

Unity · Версия 2020.3 LTS · Scripting · ParticleSystemRenderer

ParticleSystemRenderer.normalDirection

public float normalDirection;

Описание

Определяет, насколько частица рекламного щита ориентирует свои нормали к камере.

Установите значение 0, чтобы сделать нормали рекламных щитов сферическими. Установите значение 1, чтобы нормали были обращены к камере.

using UnityEngine;
using UnityEditor;
using System.Collections;

[RequireComponent(typeof(ParticleSystem))]
public class ExampleClass : MonoBehaviour {

    private ParticleSystem ps;
    private ParticleSystemRenderer psr;
    public float normalDirection = 1.0f;

    void Start() {

        ps = GetComponent<ParticleSystem>();
        psr = GetComponent<ParticleSystemRenderer>();

        psr.material = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat");
    }

    void Update() {

        psr.normalDirection = normalDirection;
    }

    void OnGUI() {

        normalDirection = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), normalDirection, 0.0f, 1.0f);
    }
}

Обновлено 17 ноября 2026 г.