Example #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;
    }
Example #2
0
    public void Act()
    {
        float chargeCap   = c_playerData.f_jumpPower;
        float chargeValue = c_playerData.f_currentJumpCharge;
        float chargeDelta = c_playerData.f_jumpChargeRate;

        cart_increment.Increment(ref chargeValue, chargeDelta * Time.deltaTime, chargeCap);

        c_playerData.f_currentJumpCharge = chargeValue;

        Vector3    currentNormal        = c_playerData.v_currentNormal;
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;

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

        c_playerData.v_currentNormal          = currentNormal;
        c_playerData.q_currentRotation        = currentRotation;
        c_positionData.q_currentModelRotation = currentModelRotation;
    }
Example #3
0
    public void Act()
    {
        Vector3    currentNormal        = c_collisionData.v_surfaceNormal;
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;

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

        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;
    }