mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
提交
This commit is contained in:
@@ -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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user