From afe00a1dde80eb1c0a7bb668b75f4c3733d3fa43 Mon Sep 17 00:00:00 2001 From: Jie Date: Thu, 10 Oct 2024 19:42:26 +0800 Subject: [PATCH] fix: trail incorrect offset close #335 --- Packages/src/Runtime/UIParticleRenderer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Packages/src/Runtime/UIParticleRenderer.cs b/Packages/src/Runtime/UIParticleRenderer.cs index 53a060b..3417e10 100644 --- a/Packages/src/Runtime/UIParticleRenderer.cs +++ b/Packages/src/Runtime/UIParticleRenderer.cs @@ -542,6 +542,12 @@ private Matrix4x4 GetWorldMatrix(Vector3 psPos, Vector3 scale) return Matrix4x4.Translate(psPos) * Matrix4x4.Scale(scale); case ParticleSystemSimulationSpace.World: + if (_isTrail) + { + return Matrix4x4.Translate(psPos) + * Matrix4x4.Scale(scale) + * Matrix4x4.Translate(-psPos); + } return Matrix4x4.Scale(scale); case ParticleSystemSimulationSpace.Custom: return Matrix4x4.Translate(_particleSystem.main.customSimulationSpace.position.GetScaled(scale))