This project has moved and is read-only. For the latest updates, please go here.

ApplyLinearImpulse Jump stops horizontal motion

Topics: Developer Forum, User Forum
Apr 3, 2012 at 3:27 AM


I'm in somewhat of a particular situation with my setup. I'm developing a platformer for the Zune HD (yeah, that old thing!) as a hobby, and I've decided to use Farseer 3.2 build 76178 with it because it's the latest version which is compatible that I cared to test. Anyways, without much documentation to go off of I ended up modifying the ol' box+wheel character model. I've got a big wheel attached to a box with a revolute joint, and sometimes I slap a weld joint between them to stop the character.

My issue is jumping. I think I've got most of it down except that, when I apply a linear impulse to the character, it basically halts horizontal movement.

protected void Jump(float dt)
            if (jumpDelayTime < 0)
                jumpDelayTime += dt;
            if (State != CharState.Jumping && jumpDelayTime >= 0) //start a jump
                //motor.MotorSpeed = 0;
                jumpImpulse.Y = -jumpImpulse; //defined in class
                fixture.Body.ApplyLinearImpulse(jumpImpulse, fixture.Body.Position);
                jumpDelayTime = -nextJumpDelayTime;
                State = CharState.Jumping;

 Now if I make the X component of the jump impulse 1000 times the current linear X velocity, it looks about right. But obviously that's just avoiding my real lack of understanding of what's going on here. For the record I have linear damping at 0 for the fixtures that make up the character.

I'm also a little concerned about how large (10,000f) the jumpImpulse value has to be to lift my character off the ground. I chalk this up to my current lack of scale organization this early in the project (still kind of deciding on my model), unless it's related to this issue. Also for the record, gravity is 98.1, my character's mass is 10.