mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 23:34:53 +08:00
[unity] Fixed physics inheritance ignoring transform rotation. Closes #2538.
This commit is contained in:
parent
63dc7d1bb8
commit
96797adeb5
@ -400,12 +400,13 @@ namespace Spine.Unity {
|
||||
if (physicsPositionInheritanceFactor != Vector2.zero) {
|
||||
Vector2 position = GetPhysicsTransformPosition();
|
||||
Vector2 positionDelta = (position - lastPosition) / meshScale;
|
||||
|
||||
positionDelta = transform.InverseTransformVector(positionDelta);
|
||||
if (physicsMovementRelativeTo != null) {
|
||||
positionDelta.x *= physicsMovementRelativeTo.lossyScale.x;
|
||||
positionDelta.y *= physicsMovementRelativeTo.lossyScale.y;
|
||||
positionDelta = physicsMovementRelativeTo.TransformVector(positionDelta);
|
||||
}
|
||||
positionDelta.x *= physicsPositionInheritanceFactor.x / transform.lossyScale.x;
|
||||
positionDelta.y *= physicsPositionInheritanceFactor.y / transform.lossyScale.y;
|
||||
positionDelta.x *= physicsPositionInheritanceFactor.x;
|
||||
positionDelta.y *= physicsPositionInheritanceFactor.y;
|
||||
|
||||
skeleton.PhysicsTranslate(positionDelta.x, positionDelta.y);
|
||||
lastPosition = position;
|
||||
|
||||
@ -522,12 +522,14 @@ namespace Spine.Unity {
|
||||
if (physicsPositionInheritanceFactor != Vector2.zero) {
|
||||
Vector2 position = GetPhysicsTransformPosition();
|
||||
Vector2 positionDelta = position - lastPosition;
|
||||
|
||||
positionDelta = transform.InverseTransformVector(positionDelta);
|
||||
if (physicsMovementRelativeTo != null) {
|
||||
positionDelta.x *= physicsMovementRelativeTo.lossyScale.x;
|
||||
positionDelta.y *= physicsMovementRelativeTo.lossyScale.y;
|
||||
positionDelta = physicsMovementRelativeTo.TransformVector(positionDelta);
|
||||
}
|
||||
positionDelta.x *= physicsPositionInheritanceFactor.x / transform.lossyScale.x;
|
||||
positionDelta.y *= physicsPositionInheritanceFactor.y / transform.lossyScale.y;
|
||||
positionDelta.x *= physicsPositionInheritanceFactor.x;
|
||||
positionDelta.y *= physicsPositionInheritanceFactor.y;
|
||||
|
||||
skeleton.PhysicsTranslate(positionDelta.x, positionDelta.y);
|
||||
lastPosition = position;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core.",
|
||||
"version": "4.2.66",
|
||||
"version": "4.2.67",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user