Esempio n. 1
0
        private void FixedUpdate()
        {
            if (floatToSleep)
            {
                if (body.IsSleeping())
                {
                    floatDelay = 0f;
                    return;
                }

                if (body.velocity.sqrMagnitude < 0.0001f)
                {
                    floatDelay += Time.deltaTime;
                    if (floatDelay >= 1f)
                    {
                        return;
                    }
                }
                else
                {
                    floatDelay = 0f;
                }
            }

            body.AddForce(CustomGravity.GetGravity(body.position), ForceMode.Acceleration);
        }
Esempio n. 2
0
        private void FixedUpdate()
        {
            Vector3 gravity = CustomGravity.GetGravity(body.position, out upAxis);

            UpdateState();
            AdjustVelocity();

            if (desiredJump)
            {
                desiredJump = false;
                Jump(gravity);
            }

            velocity     += gravity * Time.deltaTime;
            body.velocity = velocity;

            ClearState();
        }