Elastic Joint

Topics: User Forum
Apr 6, 2011 at 6:51 PM

Hi all,


First of all I just want to say that Farseer Physics is bloody incredible.  I'm so impressed with how easy it is to use.  I've just got a bit of a question now.  I 'm trying to create a Rayman style arm for my character so that when he walks around I can affect it with a sin wave swinging back and forth. (this i'm ok with).  However, when the player presses a button I want the fist to fly out in front of them (I apply a force to the fist body to make this happen).

The trouble i'm having is that I can't seem to find a joint that offers the freedom I need for the punch as well as the restriction I need for generally moving around.  Can anyone offer any advice as to how to go about solving this?



Apr 8, 2011 at 10:17 PM

I guess you could experiment with the distance joint and perhaps the revolute joint. I'm not sure if you can achieve the desired effect with a single joint. Try posting a video of the effect you want.

Apr 10, 2011 at 12:16 PM

Hi Genbox,

Thanks for the reply.  I video of the effect I want can be seen being used a few times from 3:35 on here: http://www.youtube.com/watch?v=r3Eu7BzK3NI&feature=related.

While I've got you; is there a way in the oncollision event to say that when two particular bodies collide that one of them is immovable.


if (fixtureB.Body == thingImCarryingBody)





Cheers for replying :)


Apr 10, 2011 at 1:51 PM

You want one of the bodies to be immovable on collision?

You could try changing it to a kinematic body (change the bodytype) or you simply save the position and rotation of the body, and set it back once the simulation step is over.

Apr 11, 2011 at 12:11 PM

Unfortunately the kinematic body isn't ideal as it means the object isn't subject to all the other Dynamic body style reactions it should be.  I tried saving the position and rotation but that gets in the way of the player moving while holding something.  It's ok though.  This all comes down to the way my custom joint does non-realistic behaviour so I'm going to rip it out and instead turn the punching hand into a kinematic body attached to a rope joint and manually update it.

Thanks for the responses on this.