This commit is contained in:
PC-20230316NUNE\Administrator
2024-02-02 15:38:13 +08:00
parent 877dca3b43
commit 00f56e11c7
228 changed files with 36944 additions and 20084 deletions

View File

@@ -34,12 +34,14 @@ namespace Pathfinding.Legacy {
public new bool enableRotation = true;
public new float rotationSpeed = 30;
public void Update () {
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
{
base.OnSyncUpdate(dt, frame, input);
if (rvoAgent == null) return;
RaycastHit hit;
Vector3 pos = tr.position + CalculateMovementDelta(Time.deltaTime);
Vector3 pos = tr.position + CalculateMovementDelta(GetSync().Time.deltaTime);
if (mask != 0 && Physics.Raycast(pos + Vector3.up*height*0.5f, Vector3.down, out hit, float.PositiveInfinity, mask)) {
pos.y = hit.point.y;
@@ -49,7 +51,9 @@ namespace Pathfinding.Legacy {
tr.position = pos + Vector3.up*(height*0.5f - center);
if (enableRotation && velocity != Vector3.zero) transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(velocity), Time.deltaTime * rotationSpeed * Mathf.Min(velocity.magnitude, 0.2f));
if (enableRotation && velocity != Vector3.zero) transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(velocity), GetSync().Time.deltaTime * rotationSpeed * Mathf.Min(velocity.magnitude, 0.2f));
}
}
}