fix: sub-emitter particles may not render correctly in certain scenarios

close #348
develop-preview^2
mob-sakai 2025-01-03 22:50:36 +09:00
parent 67de3d1bd3
commit 8276684c3b
1 changed files with 18 additions and 0 deletions

View File

@ -548,6 +548,24 @@ namespace Coffee.UIExtensions
* Matrix4x4.Scale(scale)
* Matrix4x4.Translate(-psPos);
}
if (_mainEmitter)
{
if (_mainEmitter.IsLocalSpace())
{
return Matrix4x4.Translate(psPos)
* Matrix4x4.Scale(scale)
* Matrix4x4.Translate(-psPos);
}
else
{
psPos = _particleSystem.transform.position - _mainEmitter.transform.position;
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))