private void SetControllerState(VehicleAbstractController controller, Vector3 position, Quaternion rotation, Vector3 linearVelocity, Vector3 angularVelocity, bool crashed) { SetControllerState(controller, position, rotation, linearVelocity, angularVelocity, crashed, controller.IsSleeping, 0); }
private void SetControllerState(VehicleAbstractController controller, Vector3 position, Quaternion rotation, Vector3 linearVelocity, Vector3 angularVelocity, bool crashed, bool isSleeping, int sleepingOutSync) { controller.IsCrashed = crashed; VehicleDynamicPredictionUtility.SetControllerState(controller, position, rotation, linearVelocity, angularVelocity, isSleeping, sleepingOutSync); }
private void SetWheelAngleFromState(VehicleAbstractController controller, VehicleAbstractInternState internalState) { var wheelCount = controller.WheelCount; for (int i = 0; i < wheelCount; ++i) { var wheel = controller.GetWheel(i); wheel.wheelCollider.steerAngle = internalState.Wheels[i].WheelSteerAngle; } }
private void SetWheelAnglesFromCmd(VehicleAbstractController controller, VehicleCmd cmd) { var wheelCount = controller.WheelCount; for (int i = 0; i < wheelCount; ++i) { var wheel = controller.GetWheel(i); wheel.wheelCollider.steerAngle = cmd.Steerables[i].Car.Angle; } }
private void SetWheelPosesFromCmd(VehicleAbstractController controller, VehicleCmd cmd) { var wheelCount = controller.WheelCount; for (int i = 0; i < wheelCount; ++i) { var wheel = controller.GetWheel(i); var wd = controller.GetWheelData(i); wheel.wheelTransform.localPosition = cmd.Steerables[i].Car.Position; wheel.wheelTransform.localRotation = cmd.Steerables[i].Car.Rotation; // wd.Grounded = cmd.Steerables[i].Car.Grounded; // wd.GroundedOnTerrain = cmd.Steerables[i].Car.Grounded; } }
private void SetWheelEntityInput(VehicleAbstractController controller, VehicleAbstractInternState internalState) { controller.steerInput = internalState.SteerInput; controller.throttleInput = internalState.ThrottleInput; controller.handbrakeInput = internalState.HandbrakeInput; controller.isHornOn = internalState.IsHornOn; controller.isAccelerated = internalState.IsAccelerated; if (controller.ControllerType == VehicleControllerType.Car) { var carInternState = (CarInternState)internalState; controller.brakeInput = carInternState.BrakeInput; } else if (controller.ControllerType == VehicleControllerType.Motor) { var motorController = (MotorcycleController)controller; var motorInsternState = (MotorInternState)internalState; motorController.stuntInput = motorInsternState.StuntInput; motorController.horizontalMassShift = motorInsternState.HorizontalShift; } }