예제 #1
0
        private void Steer()
        {
            var dt = (float)Game.UpdateTime.Elapsed.TotalSeconds;

            steerAngle = maxSteerAngle * horizontalInput * dt;

            rb.ApplyTorque(Entity.Transform.WorldMatrix.Up * turnSpeed * steerAngle);

            //  FR.steerAngle = -steerAngle;
            //  FL.steerAngle = -steerAngle;
        }
예제 #2
0
        public override void Update()
        {
            var horizontal = -Input.GetVirtualButton(0, "Horizontal");
            var vertical   = Input.GetVirtualButton(0, "Vertical");

            var cameraLookDirection = Vector3.UnitZ;

            Camera.Entity.Transform.Rotation.Rotate(ref cameraLookDirection);
            cameraLookDirection.Y = 0;
            cameraLookDirection.Normalize();

            var torqueHorizontal = cameraLookDirection * 2 * horizontal;
            var torqueVertical   = Vector3.Cross(cameraLookDirection, Vector3.UnitY) * 2 * vertical;

            _rigidbody.ApplyTorque(torqueHorizontal + torqueVertical);
        }