"Fall damage" error!

Report bugs of MFPS 2.0 here
Post Reply
User avatar
Oggy
Contributor
Contributor
Posts: 80
Joined: Fri Oct 13, 2017 2:53 am

User avatar
Lovatto
Admin
Admin
Posts: 1772
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Thanks for the video, you get any log in console when this happen?
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Oggy
Contributor
Contributor
Posts: 80
Joined: Fri Oct 13, 2017 2:53 am

Lovatto wrote:Thanks for the video, you get any log in console when this happen?
no, i don't get any log in console.
User avatar
websbk
Contributor
Contributor
Posts: 174
Joined: Fri Aug 04, 2017 5:34 pm

Yes ,there is , in the console no errors , but when you jump the earth was divided time and again
User avatar
Oggy
Contributor
Contributor
Posts: 80
Joined: Fri Oct 13, 2017 2:53 am

I don't understand. Can you explain clearly?
User avatar
byyasin
New Member
New Member
Posts: 9
Joined: Sat May 09, 2020 3:23 am

Same problem. I Fixed Change this methods;

bl_FirstPersonController.cs

Code: Select all

   void CalculateFall()
    {
        if (JumpInmune) { JumpInmune = false; return; }
        if ((Time.time - fallingTime) <= 0.4f) return;

        float ver = HigherPointOnJump - m_Transform.position.y;
        if (JumpDirection == -1)
        {
            float normalized = m_Transform.position.y - Mathf.Abs(PostGroundVerticalPos); // no plus, to be minus
            ver = Mathf.Abs(normalized);
        }
        if (ver > SafeFallDistance)
        {
            int damage = Mathf.FloorToInt((ver / DeathFallDistance) * 100);
            DamageManager.GetFallDamage(damage);
        }
        PlayLandingSound((ver / DeathFallDistance));
        Debug.Log(string.Format("--------------------"));
        Debug.Log(string.Format("m_Transform.position.y: {0}", m_Transform.position.y));
        Debug.Log(string.Format("PostGroundVerticalPos: {0}", PostGroundVerticalPos));
        Debug.Log(string.Format("distance: {0}", ver));
    }


    void FallingCalculation()
    {
        if (m_Transform.position.y == PostGroundVerticalPos) return;

        if (JumpDirection == 0)
        {
            JumpDirection = (m_Transform.position.y > PostGroundVerticalPos) ? 1 : -1;
        }
        else if (JumpDirection == 1)
        {
            if (m_Transform.position.y < PostGroundVerticalPos && !isClimbing) // && !isClimbing fix to down to ladder fall
            {
                HigherPointOnJump = PostGroundVerticalPos;
            }
            else
                PostGroundVerticalPos = m_Transform.position.y;
        }
    }
Post Reply