mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 10:14:14 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetVelocity = (TargetTransform.position - _lastTargetPosition) / Time.fixedDeltaTime;
|
var reference = Locator.GetCenterOfTheUniverse().GetStaticReferenceFrame().transform;
|
||||||
_lastTargetPosition = TargetTransform.position;
|
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 reference = Locator.GetCenterOfTheUniverse().GetStaticReferenceFrame().transform;
|
||||||
var currentRelPosition = reference.InverseTransformPoint(transform.position);
|
var currentRelPosition = reference.InverseTransformPoint(transform.position);
|
||||||
Velocity = (currentRelPosition - _prevRelPosition) / Time.fixedDeltaTime;
|
Velocity = (currentRelPosition - _prevRelPosition) / Time.fixedDeltaTime;
|
||||||
_prevRelPosition = reference.InverseTransformPoint(transform.position);
|
_prevRelPosition = currentRelPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user