mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
PredictedRigidbody: add OnBeforeApplyState callback
This commit is contained in:
parent
157bf67a86
commit
3354363eae
@ -431,6 +431,7 @@ void RecordState()
|
||||
|
||||
// optional user callbacks, in case people need to know about events.
|
||||
protected virtual void OnSnappedIntoPlace() {}
|
||||
protected virtual void OnBeforeApplyState() {}
|
||||
protected virtual void OnCorrected() {}
|
||||
|
||||
void ApplyState(double timestamp, Vector3 position, Quaternion rotation, Vector3 velocity)
|
||||
@ -468,6 +469,11 @@ void ApplyState(double timestamp, Vector3 position, Quaternion rotation, Vector3
|
||||
return;
|
||||
}
|
||||
|
||||
// we have a callback for snapping into place (above).
|
||||
// we also need one for corrections without snapping into place.
|
||||
// call it before applying pos/rot/vel in case we need to set kinematic etc.
|
||||
OnBeforeApplyState();
|
||||
|
||||
// Rigidbody .position teleports, while .MovePosition interpolates
|
||||
// TODO is this a good idea? what about next capture while it's interpolating?
|
||||
if (correctionMode == CorrectionMode.Move)
|
||||
|
Loading…
Reference in New Issue
Block a user