浏览代码

Fix for boat reseting

/demo-work
André McGrail 5 年前
当前提交
9314b02e
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1
      Assets/Scripts/Boat/AIcontroller.cs
  2. 3
      Assets/Scripts/Boat/BoatController.cs

1
Assets/Scripts/Boat/AIcontroller.cs


if (idleTime > 4f)
{
Debug.Log($"AI boat {gameObject.name} was stuck, respawing.");
idleTime = 0f;
controller.ResetPosition();
}

3
Assets/Scripts/Boat/BoatController.cs


var resetMatrix = WaypointGroup.instance.GetClosestPointOnWaypoint(transform.position);
var resetPoint = resetMatrix.GetColumn(3);
resetPoint.y = spawnPosition.GetColumn(3).y;
transform.SetPositionAndRotation(resetPoint, resetMatrix.rotation);
engine.RB.position = resetPoint;
engine.RB.rotation = resetMatrix.rotation;
}
}

正在加载...
取消
保存