Sprite Render 設置

Alignment: Custom Alignment

FacingMode: Custom Facing Vector

新增 Sprite Facing and Alignment

在Particle Spawn底下新增 Sprite Facing and Alignment

Module Usage Note

On the sprite renderer, setting facing or alignment to custom allows these vectors to control the orientation of sprites. By default the renderer attributes are bound to Particles.SpriteFacing and Particles. Sprite Alignment. If this module is used in an emitter script, it sets the emitter versions of these attributes instead for use when the sprite source mode is set to “Emitter”. Sprite facing can be considered the normal of the particle.

Sprite alignment can be considered the tangent to that normal.

If only sprite facing is set to custom, alignment will do its best to orient around that facing direction.

Sprite Facing and Alignment are always World Space vectors, so we provide some default transformations when working in Localspace which can be overridden.

可以將 Sprite Facing 視為 Sprite 的法線,Alignment 視為該法線的切線

Facing 設為 (0, 0, 1) → Sprite面垂直 Z 軸、正面朝 Z 正軸

Alignment 設為(0, 1, 0) → Sprite 貼圖的頂部朝 Y 正軸

Image

這邊的向量只會影響 Sprite 貼圖的方向,大小不會影響,所以數字都設為 1

想得效的效果:Sprite貼圖頂部全朝向Emitter的中心(或相反)

Image

新增一個 Module,要 Get 的屬性有兩個

  1. Particle Position

  2. Engine Owner Position

一個是每顆粒子的位置,一個是發射器的初始位置

兩者相減,得出的向量連接Dirction and Length Safe,作用是讀取向量的方向和長度

將向量的方向 Set Particle Alignment 後,Library Visibility 選擇 Exposed,再應用到 Particle Spawn 底下

這時獲得一個愛心都朝內的效果了!

Image

如果要朝外,可以把兩個向量對調,或是在 Initialize Particle 的 UV Mode 設 Custom 直接把 Y 改為 -1,愛心就會直接朝外了