Apply Angular Impulse.

Dec 27, 2011 at 3:21 PM

I have method which check for the user input when this method runs an event is fired where a circular body is given a angular impulse. This does not work for some reason. I have tried LinearVelocity and it works but the other way does not.
Here is snippet

 public override void HandleInput(InputHelper input)
        {
           
            _xVelocity = 0;

            if (input.CurrentMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                if (input.CurrentMouseState.Y >= 240)
                {
                    System.Diagnostics.Debug.WriteLine(_ballBody.Position);
                    _xVelocity = 20;
                }
                else
                {
                    _ballBody.ApplyForce(new Vector2(-10, 0));
                }
            }

            if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))
            {
                _xVelocity = 20;
            }
            else if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left))
            {
                _xVelocity = -20;
            }
            _ballBody.ApplyAngularImpulse(15f);
            _ballBody.LinearVelocity = new Vector2(_xVelocity, 0);
            base.HandleInput(input);
        }