public void Act() { // check for angle when implemented float currentVelocity = c_playerData.f_currentSpeed; float deceleration = c_playerData.f_brakePower; float slowScaling = c_playerInputData.f_inputAxisLVert * -1; Vector3 currentPosition = c_playerData.v_currentPosition; Vector3 currentNormal = c_playerData.v_currentNormal; Quaternion currentRotation = c_playerData.q_currentRotation; AccelerationCartridge.Decelerate(ref currentVelocity, deceleration * slowScaling); AccelerationCartridge.DecelerateFriction(ref currentVelocity, 0.1f, currentRotation); VelocityCartridge.UpdatePositionTwo(ref currentPosition, ref currentRotation, ref currentVelocity); c_playerData.f_currentSpeed = currentVelocity; c_playerData.v_currentPosition = currentPosition; c_playerData.v_currentNormal = currentNormal.normalized; c_playerData.v_currentDown = currentNormal.normalized * -1; c_playerData.q_currentRotation = currentRotation; }
public void Act() { Quaternion currentModelRotation = c_positionData.q_currentModelRotation; Quaternion currentRotation = c_playerData.q_currentRotation; float currentSpeed = c_playerData.f_currentSpeed; float currentTurnSpeed = c_turnData.f_currentTurnSpeed; float currentRealTurnSpeed = c_turnData.f_currentRealTurnSpeed; float targetTurnAccel = c_turnData.f_turnAcceleration * c_playerInputData.f_inputAxisLHoriz; float turnSpeedCap = Mathf.Abs(c_turnData.f_turnTopSpeed * c_playerInputData.f_inputAxisLHoriz); float turnSign = Mathf.Sign(targetTurnAccel); AccelerationCartridge.CalculateInterpolatedAcceleration(out float currentTurnAccel, targetTurnAccel, turnSpeedCap * turnSign * Constants.NEGATIVE_ONE, turnSpeedCap * turnSign, currentTurnSpeed); AccelerationCartridge.AccelerateAbs(ref currentTurnSpeed, currentTurnAccel, turnSpeedCap); AccelerationCartridge.AccelerateAbs(ref currentRealTurnSpeed, currentTurnAccel, turnSpeedCap, c_turnData.f_currentSurfaceFactor); HandlingCartridge.Turn(Vector3.up, currentTurnSpeed * Time.fixedDeltaTime, ref currentModelRotation); HandlingCartridge.Turn(Vector3.up, currentRealTurnSpeed * Time.fixedDeltaTime, ref currentRotation); HandlingCartridge.AddTurnCorrection(Vector3.up, ref currentModelRotation, currentRotation, c_positionData.i_switchStance); AccelerationCartridge.Decelerate(ref currentSpeed, Mathf.Abs(currentRealTurnSpeed / c_turnData.f_turnTopSpeed) * c_turnData.f_turnSpeedDeceleration * Time.fixedDeltaTime); c_positionData.q_currentModelRotation = currentModelRotation; c_playerData.q_currentRotation = currentRotation; c_turnData.f_currentTurnSpeed = currentTurnSpeed; c_turnData.f_currentRealTurnSpeed = currentRealTurnSpeed; c_playerData.f_currentSpeed = currentSpeed; }