public override void Tick() { var vel = (Input.Rot.Forward * Input.Forward) + (Input.Rot.Left * Input.Left); vel = vel.Normal * 2000; if (Input.Down(InputButton.Run)) { vel *= 5.0f; } if (Input.Down(InputButton.Duck)) { vel *= 0.2f; } Velocity += vel * Time.Delta; if (Velocity.LengthSquared > 0.01f) { Pos += Velocity * Time.Delta; } Velocity = Velocity.Approach(0, Velocity.Length * Time.Delta * 5.0f); if (Input.Down(InputButton.Jump)) { Velocity = Velocity.Approach(0, Velocity.Length * Time.Delta * 5.0f); } WishVelocity = Velocity; GroundEntity = null; }
public override void Simulate() { float fvel = Input.Forward; if (Input.Down(InputButton.Run)) { fvel *= 10.0f; } Vector3 vel = (Input.Rotation.Forward * fvel) + (Input.Rotation.Left * Input.Left); vel = vel.Normal * 2000; if (Input.Down(InputButton.Duck)) { vel *= 0.2f; } Velocity += vel * Time.Delta; Velocity = Velocity.WithZ(0.0f); if (Velocity.LengthSquared > 0.01f) { Position += Velocity * Time.Delta; } Velocity = Velocity.Approach(20, Velocity.Length * Time.Delta * 0.7f); EyeRot = Input.Rotation; WishVelocity = Velocity; }