public static void SetVehicleDynamicPrediction(VehicleContext context, bool isPredict) { if (SharedConfig.DynamicPrediction == isPredict) { return; } var vehicles = context.GetEntities(); foreach (var vehicle in vehicles) { if (vehicle.hasEntityKey) { if (SharedConfig.IsServer) { if (vehicle.HasDriver()) { vehicle.SetKinematic(!isPredict); } } else { if (!vehicle.HasDriver()) { vehicle.SetKinematic(!isPredict); } VehicleStateUtility.SetVehicleSyncLatest(vehicle, isPredict); } } } SharedConfig.DynamicPrediction = isPredict; }
public static void ShowVehicles(VehicleContext context, bool isServer) { if (SharedConfig.IsServer == isServer) { var vehicles = context.GetEntities(); foreach (var vehicle in vehicles) { if (vehicle.hasGameObject) { var go = vehicle.gameObject.UnityObject.AsGameObject; if (go.activeSelf) { var linVel = vehicle.GetLinearVelocity(); var position = go.transform.position; var eulerAngles = go.transform.rotation.eulerAngles; _logger.InfoFormat("vehicle name {0} position {1} rotation {2} linearVelocity {3}", go.name, position, eulerAngles, linVel); } } } } }