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

[SOLVED] Creating a revolute joint to a kenematic body makes VS highlight Debug.Assert() to the RevoluteJoint.cs

Topics: Developer Forum
Nov 26, 2012 at 2:27 AM
Edited Nov 26, 2012 at 3:16 AM

I have 2 objects a Wood and a Pin. I am attaching the kenematic body Wood to the static body Pin. I set an angular velocity to the wood so that it would turn/rotate forever. But the problem is why does it open the breakpoints or it highlights the Debug.Assert() inside the RevoluteJoint.cs

Does this mean we can't attach a revolute join to a kenematic body? I need help guys. :(


Nov 26, 2012 at 11:45 PM

A joint between a static and kinematic body makes no sense. Static body doesn't move. Kinematic body moves by manually setting its transform/velocities. A joint gets simulated by the engine to affect the position/velocity of the connected bodies. At least one of those bodies must be dynamic for the joint to do its work otherwise it just won't do anything and eventually will become unstable i.e. the constraint it represents will be impossible to satisfy.

In other words: by making a RevoluteJoint you tell the engine: "I want these bodies to be pinned at a common anchor but they can rotate relative to each other". The solver says "I'm going to modify the bodies positions so the constraint is put in practice". Only it can't - because it won't move a static body or a kinematic body.

On the other hand you can have a joint between static and dynamic or kinematic and dynamic just fine because the solver will move the dynamic body around  until it's where the joints wants it to be while not having to touch the static or kinematic body at all. So you can attach a joint to a kinematic body but the other body must be dynamic.

Nov 27, 2012 at 1:17 PM

Thank you bro. You have a good point. I just didn't realize it is actually add what I was trying to do to attach a static to a kenematic body.

So I want to create a rotating stick and the anchor to the bottom of the stick. so how can I do it bro? Please. I tried making a static body like a Nail, and the dynamic Stick. I attached a revolute joint to them. and added angular velocity to the stick. but the velocity is not constant. it changes by gravity. How can I make it constant?

Nov 27, 2012 at 8:06 PM

You can do some maths to factor in the effect of gravity. Or, alternatively, cancel the effect of gravity each step by applying a force to the body opposite and equal in magnitude to the gravity.

Nov 27, 2012 at 11:33 PM

I've implemented something too. I am re initializing the AngularVelocity back to it's value always in the Update() method. Will also try your idea applying opposite force. Thank you bro.