Пример #1
0
    public void Act()
    {
        Vector3    currentNormal        = c_collisionData.v_surfaceNormal;
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;
        float      currentVelocity      = c_playerData.f_currentSpeed;

        AngleCalculationCartridge.AlignToSurfaceByTail(c_collisionData.v_surfaceNormal,
                                                       ref currentRotation,
                                                       ref currentNormal,
                                                       1);
        AngleCalculationCartridge.AlignToSurfaceByTail(c_collisionData.v_surfaceNormal,
                                                       ref currentModelRotation,
                                                       ref currentNormal,
                                                       1);

        // boosting adds an extra acceleration force, scale boost rate by vertical direction
        float scaledBoost = Mathf.Max((c_playerData.q_currentRotation * Vector3.forward).y * c_playerData.f_boostAcceleration * Constants.NEGATIVE_ONE, Constants.ZERO_F);

        Debug.Log(scaledBoost);
        AccelerationCartridge.AccelerateAbs(ref currentVelocity, scaledBoost * Time.fixedDeltaTime, c_playerData.f_topSpeed);

        c_playerData.f_currentSpeed           = currentVelocity;
        c_playerData.v_currentNormal          = currentNormal;
        c_playerData.q_currentRotation        = currentRotation;
        c_positionData.q_currentModelRotation = currentModelRotation;

        c_aerialMoveData.f_verticalVelocity = Vector3.Dot(c_playerData.q_currentRotation * Vector3.forward, Vector3.up) * c_playerData.f_currentSpeed;
    }
Пример #2
0
    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;
    }
Пример #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;
    }
Пример #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;
    }
Пример #5
0
    public void Act()
    {
        // check for angle when implemented
        float      currentVelocity      = c_playerData.f_currentSpeed;
        Vector3    currentPosition      = c_playerData.v_currentPosition;
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_playerPositionData.q_currentModelRotation;

        AccelerationCartridge.AccelerateGravity(ref currentVelocity,
                                                c_playerData.f_gravity,
                                                c_playerData.f_topSpeed,
                                                ref currentRotation,
                                                ref currentModelRotation);

        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.q_currentRotation = currentRotation;
    }