mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
calculate velocity relative to the reference on anglers
This commit is contained in:
parent
c7b221a840
commit
728efc69df
@ -28,7 +28,9 @@ public class QSBAngler : LinkedWorldObject<AnglerfishController, AnglerTransform
|
||||
return;
|
||||
}
|
||||
|
||||
TargetVelocity = (TargetTransform.position - _lastTargetPosition) / Time.fixedDeltaTime;
|
||||
_lastTargetPosition = TargetTransform.position;
|
||||
var reference = Locator.GetCenterOfTheUniverse().GetStaticReferenceFrame().transform;
|
||||
var currentRelPosition = reference.InverseTransformPoint(TargetTransform.position);
|
||||
TargetVelocity = (currentRelPosition - _lastTargetPosition) / Time.fixedDeltaTime;
|
||||
_lastTargetPosition = currentRelPosition;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ public class RemotePlayerVelocity : MonoBehaviour
|
||||
var reference = Locator.GetCenterOfTheUniverse().GetStaticReferenceFrame().transform;
|
||||
var currentRelPosition = reference.InverseTransformPoint(transform.position);
|
||||
Velocity = (currentRelPosition - _prevRelPosition) / Time.fixedDeltaTime;
|
||||
_prevRelPosition = reference.InverseTransformPoint(transform.position);
|
||||
_prevRelPosition = currentRelPosition;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user