Set absolute position of physicobject

Feb 10, 2009 at 7:56 PM

Hi all!

Great job by the jiglibx team!

I have one small question. The ragdoll that comes with the great game sample (included in the source code, pls link to it because it was very hard to find!) was so inspiring that I wanted to link it together with a bone animation (provided by XNAnimation). The thing is that the bone animation gives you the absolute transforms and I want to move each part of the ragdoll to that position.

When working with jiglibx I _think_ setting the absolute position of a physicobject is incorrect. When I try move an immovable box by pressing a key:

            if (ks.IsKeyDown(Keys.F))
            {
                Matrix ori = immovableBox.PhysicsBody.Orientation;
                Vector3 pos = immovableBox.PhysicsBody.Position;
                ori += Matrix.CreateRotationY(0.1f);
                ori.Translation = Vector3.Zero;
                immovableBox.PhysicsBody.MoveTo(pos, ori);
            }

(I have done this with different approches but with no success)
The box literally flips out! It moves away, changes size and eventually dissapears from the screen. So my question is, is it possible to move a physicsobject to an absolute position and how do you do that?

Is it required to turn of the physic engine maybee?

I have one clue, and that is that position works fine, but the orientation is crazy! ;) That's why I but the ori.Translation = Vector3.Zero.

Thanks!
Carl
Coordinator
Feb 16, 2009 at 2:45 PM
ori += Matrix.CreateRotationY(0.1f);

makes no sense. If you want to rotate further your have to multiply the matrices:

ori *= Matrix.CreateRotationY(0.1f);
Feb 17, 2009 at 1:23 PM
Edited Feb 17, 2009 at 1:35 PM

Thanks for the reply!

That actually answered my question. I have seen now that the problem isn't in the JigLibX :)