fix: the ParticleSystem's localPosition drifts at certain scales due to floating-point precision issues
close #299, close #312pull/318/head
parent
19989cf18c
commit
e924eb4596
|
@ -632,6 +632,8 @@ namespace Coffee.UIExtensions
|
|||
// get world position.
|
||||
var isLocalSpace = _particleSystem.IsLocalSpace();
|
||||
var psTransform = _particleSystem.transform;
|
||||
var originLocalPosition = psTransform.localPosition;
|
||||
var originLocalRotation = psTransform.localRotation;
|
||||
var originWorldPosition = psTransform.position;
|
||||
var originWorldRotation = psTransform.rotation;
|
||||
var emission = _particleSystem.emission;
|
||||
|
@ -654,7 +656,8 @@ namespace Coffee.UIExtensions
|
|||
: originWorldPosition.GetScaled(scale.Inverse());
|
||||
psTransform.SetPositionAndRotation(scaledPos, originWorldRotation);
|
||||
_particleSystem.Simulate(deltaTime, false, false, false);
|
||||
psTransform.SetPositionAndRotation(originWorldPosition, originWorldRotation);
|
||||
psTransform.localPosition = originLocalPosition;
|
||||
psTransform.localRotation = originLocalRotation;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
|
Loading…
Reference in New Issue