Beispiel #1
0
        protected override void PhysicsUpdate()
        {
            ChunkBoxCollisionProvider.CollideWorld(Collider, Axis.Y);

            if (IsPicked)
            {
                PickTimer -= Time.PhysicsDelta;
                PickMove();
            }
        }
Beispiel #2
0
        protected override void LatePhysicsUpdate()
        {
            //Debug.Log(Time.PhysicsDelta);
            if (this.RigidBody == null || this.Collider == null)
            {
                return;
            }

            double xzVel = this.RigidBody.Velocity.XZ.Length;


            Vector2D xzDir = this.RigidBody.Velocity.Normalized.XZ;



            uint currentHeight = 1 + World.GetSurface(this.WObject.Position, "winecrash:overworld");

            if (!Player.NoClipping)
            {
                if (xzVel > Player.WalkSpeed)
                {
                    this.RigidBody.Velocity *= new Vector3D(0, 1, 0);

                    this.RigidBody.Velocity += new Vector3D(xzDir.X, 0, xzDir.Y) * Player.WalkSpeed;
                }
            }


            if (AnyMoveInputOnFrame)
            {
            }
            else
            {
                if (xzVel <= Player.StopSpeed)
                {
                    this.RigidBody.Velocity *= new Vector3D(0, 1, 0);
                }

                else
                {
                    Vector2D xySpeedDecay = xzDir * xzVel * Player.WalkDeaccelerationFactor * Time.PhysicsDelta;

                    Vector2D newSpeed = (xzDir * xzVel) - xySpeedDecay;

                    this.RigidBody.Velocity = new Vector3D(newSpeed.X, this.RigidBody.Velocity.Y, newSpeed.Y);
                }
            }

            if (!Player.NoClipping)
            {
                RaycastChunkHit h = ChunkBoxCollisionProvider.CollideWorld(Collider);
            }
        }