Example #1
0
    public void Act()
    {
        Quaternion root            = c_physData.q_startRotation;
        Quaternion currentRotation = c_physData.q_startRotation;

        Vector3 spinAxis = Vector3.up;
        Vector3 flipAxis = Vector3.right;

        float currentSpinRate = c_physData.f_currentSpinRate;
        float currentFlipRate = c_physData.f_currentFlipRate;

        float currentSpinDegrees = c_physData.f_currentSpinDegrees;
        float currentFlipDegrees = c_physData.f_currentFlipDegrees;

        HandlingCartridge.Turn(flipAxis, currentFlipDegrees, ref root);
        HandlingCartridge.Turn(spinAxis, currentSpinDegrees, ref root);
        HandlingCartridge.SetRotation(ref currentRotation, root);

        cart_incr.DecrementAbs(ref currentFlipRate, c_physData.f_flipDecay * Time.fixedDeltaTime, 0.0f);
        cart_incr.DecrementAbs(ref currentSpinRate, c_physData.f_spinDecay * Time.fixedDeltaTime, 0.0f);

        c_playerPosData.q_centerOfGravityRotation = currentRotation;
        c_physData.f_currentFlipRate     = currentFlipRate;
        c_physData.f_currentSpinRate     = currentSpinRate;
        c_physData.f_currentSpinDegrees += currentSpinRate * 360f * Time.fixedDeltaTime;
        c_physData.f_currentFlipDegrees += currentFlipRate * 360f * Time.fixedDeltaTime;
    }
Example #2
0
    public void Act()
    {
        Quaternion root            = c_physData.q_startRotation;
        Quaternion currentRotation = c_physData.q_startRotation;

        Vector3 spinAxis = Vector3.up;
        Vector3 flipAxis = Vector3.right;

        float spinCeiling = c_scoringData.f_currentSpinTarget;
        float flipCeiling = c_scoringData.f_currentFlipTarget;

        float currentSpinRate = c_physData.f_currentSpinRate;
        float currentFlipRate = c_physData.f_currentFlipRate;

        float currentSpinDegrees = c_physData.f_currentSpinDegrees;
        float currentFlipDegrees = c_physData.f_currentFlipDegrees;

        HandlingCartridge.Turn(flipAxis, currentFlipDegrees, ref root);
        HandlingCartridge.Turn(spinAxis, currentSpinDegrees, ref root);
        HandlingCartridge.SetRotation(ref currentRotation, root);
        HandlingCartridge.ValidateSpinRotation(currentSpinDegrees, currentFlipDegrees, spinCeiling, flipCeiling, ref currentSpinRate, ref currentFlipRate);

        c_playerPosData.q_centerOfGravityRotation = currentRotation;
        c_physData.f_currentFlipRate     = currentFlipRate;
        c_physData.f_currentSpinRate     = currentSpinRate;
        c_physData.f_currentSpinDegrees += currentSpinRate * 360f * Time.fixedDeltaTime;
        c_physData.f_currentFlipDegrees += currentFlipRate * 360f * Time.fixedDeltaTime;
    }
Example #3
0
    public void Act()
    {
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;

        float currentTurnSpeed     = c_turnData.f_currentTurnSpeed;
        float currentRealTurnSpeed = c_turnData.f_currentRealTurnSpeed;

        AccelerationCartridge.DecelerateAbs(ref currentTurnSpeed, c_turnData.f_turnResetSpeed);
        AccelerationCartridge.DecelerateAbs(ref currentRealTurnSpeed, c_turnData.f_turnResetSpeed);

        HandlingCartridge.Turn(Vector3.up, currentRealTurnSpeed * Time.fixedDeltaTime, ref currentRotation);
        HandlingCartridge.Turn(Vector3.up, currentTurnSpeed * Time.fixedDeltaTime, ref currentModelRotation);

        HandlingCartridge.AddTurnCorrection(Vector3.up, ref currentModelRotation, currentRotation, c_positionData.i_switchStance);

        c_positionData.q_currentModelRotation = currentModelRotation;
        c_playerData.q_currentRotation        = currentRotation;
        c_turnData.f_currentTurnSpeed         = currentTurnSpeed;
        c_turnData.f_currentRealTurnSpeed     = currentRealTurnSpeed;
    }
Example #4
0
    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;
    }
Example #5
0
    public void Act()
    {
        Quaternion currentModelRotation = c_posData.q_currentModelRotation;
        float      frameSpinValue       = c_trickPhys.f_groundResetRate * 360f * c_trickPhys.i_groundResetDir * Time.fixedDeltaTime;

        // round off the last frame of rotation if we hit our target
        if (Quaternion.Angle(c_playerData.q_currentRotation, c_posData.q_currentModelRotation) < Constants.ROTATION_TOLERANCE)
        {
            c_trickPhys.f_groundResetTarget = Constants.ZERO_F;
        }

        /*
         * if (Mathf.Abs(c_trickPhys.f_groundResetRotation + frameSpinValue) > Mathf.Abs(c_trickPhys.f_groundResetTarget))
         * {
         *  frameSpinValue = c_trickPhys.f_groundResetTarget - c_trickPhys.f_groundResetRotation;
         *  c_trickPhys.f_groundResetTarget = Constants.ZERO_F;
         * }
         */

        HandlingCartridge.Turn(c_playerData.q_currentRotation * Vector3.up, frameSpinValue, ref currentModelRotation);

        c_posData.q_currentModelRotation   = currentModelRotation;
        c_trickPhys.f_groundResetRotation += frameSpinValue;
    }