[SOLVED]Joint Stuff in NxOgre 1.0 '21

LucaMoller

22-07-2009 18:56:53

Hello,
I've been using NxOgre in the last 3 months in a project I'm participating for a game contest. It's a 3D Fighting Game. Until now I've been using physics to make the characters walk and jump over the terrain ( they are dynamic boxes or capsules locked from rotation, in which I set Linear Velocity and Orientation to do the movement ), to do some collision tests ( I put some invisible small cube kinematic actors in the bones of the skeleton of the character's mesh, and get information about their to collision with other characters bodies to do the attacking stuff ), and to set the terrain shape (with a .nxs made with flour from its mesh)
It's my first time posting in this forum, although I've read a lot of things here in the last months and got lots of usefull information.

Recently, I've decided to start programing the ragdoll simulation for the characters, which I will activate when they get hit or die. After creating some capsules around the characters body (based on the skeleton of the mesh too), I decided to create some joints between them and turn them dynamic at this moment ( this would be like the "ragdoll activation"). The problem is that I'm getting some strange results with the joints.

I'll explain here in a simple way.
I have the following capsules: left_lower_arm , left_upper_arm, right_lower_arm , right_upper_arm and the main_body
So i create the following spherical joints:
-right_lower_arm , right_upper_arm
-right_upper_arm, main_body
-left_lower_arm , left_upper_arm
- left_upper_arm, main_body
(I'm creating the anchors at the articulations, where they should be)

The result is that the capsules seems to be linked at the right places, but it also seems that they have some weird conection (between capsules i've not created joints!). Now, here comes the yellow lines in the debug renderer:
There are the following yellow line conecting the capsules:
- left_upper_arm , left_lower_arm
- left_upper_arm , right_upper_arm (?!)
- left_upper_arm , right_lower_arm (?!)

I couldn't figure out what these yellow lines from the debug renderer means yet, I've tried to learn more about joints with physx documentation and examples, but i didnt found any good explanation about this.

So, if anyone could answer some of the following questions, I would be gratefull.

- What are these yellow lines in debug renderer ??
- Does the order I create the joints makes a diference? ( It doesnt make sense if yes, but who knows... )
- Any chance there is a problem with joints in NxOgre 1.0 '21(which is the one I'm using) ?

Maybe there is no problem at all and the weird conection I mentioned is something in my head plus the yellow lines hehehe :)
But I would like to make sure there is no problem with this, because I've seem it will be a pain in the ass to configure the joint parameters to obtain a good result in gameplay.

Thanks in advance!

LucaMoller

26-07-2009 00:49:07

Today I was looking at the degub renderer parameters in PhysX documentation and discovered what the yellow lines are. :)

They are the NX_VISUALIZE_BODY_JOINT_GROUPS , they conect the objects the are conected by joints (even if not directly) to one of the objects of the conected group. So, they dont have a physical meaning at all.
They apear by default in the debug renderer created in NxOgre because of the line (in World::createDebugRenderer(Ogre::SceneManager* s)) :
sdk->setParameter(NX_VISUALIZE_BODY_JOINT_GROUPS, true);

If you want them to disapear just call the following (when everything is already running) :
World->getPhysXDriver()->setVisualisationBodyJointGroupsEnabled(0);

And the ragdoll is working fine (I started it from other positions, put some dampers for swinging and the joints are doing fine :wink: ). I was having some problems these days using the position of the capsules in the bones of the mesh's skeleton ( because physx gives me the position relative to the World and I need it relative to the bones parent, so I needed to do some math... after two frustating days, thinking the problems was in the math with the quaternions, I discovered that, even deactivating the animations of the mesh and setting bones manually controled,it wasnt completely free from them, and if I didnt started any of animations before starting the ragdoll the bone just followed the capsules and joints like they should :D )

Now I have to make this fit in my strange character controller system to have nice collisions when the attacks hit hehehe

betajaen

26-07-2009 01:37:49

Awesome.

If your app is open source and your willing; be sure to post your results and any source code so we can steal and implement it ourselves. :wink:

LucaMoller

31-07-2009 05:54:14

Sure, I'll look forward for posting something.

This is the first time i'm using big libraries like Ogre, Physx and NxOgre. ( I just had some experience with C , I started graduation last year and learned some C, participated in programing contests, and programed some 2D games , first with graphics.h , then with Allegro... ). I started this project reading C++ tutorials :mrgreen:

So, the problem with my code is that it's a total mess xD , my implemetations aren't object-oriented , they are myapp-oriented (when I programed my ragdoll I made some considerations about my app, like the fact that I know the names of the bone's mesh, that i wanted certain capsules at certain bones, etc... ) hehehe
At the top, much of the code is in written portuguese ( I'm from Brazil :) ).

I'll see if I can arrange part of it (how I manage the capsules and how I manage the mesh's skeleton) in a way it makes enough sense to be posted and I'll probably post some videos of my game when I get it working properly. :wink: