Hi,
I am trying to add ragdolls to my game, so far, I managed to get everything working except for the joints. Characters fall, but their joints twist freely.
I figured out that problem was that I was just deserializing the rigid actors and not the joints. So I went ahead and wrote something like:
-----------------------------------
if( serializable->is() )
// do something
-------------------------------------
Which didn’t work. I read it’s a problem with the headers of PxJoint. So I changed it to:
-----------------------------------
if( serializable->is() )
// do something
-------------------------------------
Which worked. The problem is that I don’t know how to translate that to a PxArticulation. I read in the guide, that for ragdolls you need to use aggregates (which are composed of actors and articulations). How do you build the articulation from the joint?? furthermore, how do you put the joint into the scene? I mean, is there a way that I can just add the joint to the scene and forget about creating articulations?
Articulations need links and articulationJoints and I don’t know how to create any of them (and I did check the guide and the API).
I’m guessing that I have to do something like this:
-----------------------------------
repx::deserializeFromRepX(data, *physxSDK, *cooking, stringTable, externalRefs,
*bufferCollection, *sceneCollection, userRefs);
// some code
PxActor* actor = NULL;
PxD6Joint* joint = NULL;
for (unsigned int i = 0; i < nbActors; ++i) {
serializable = sceneCollection->getObject(i);
if( joint = serializable->is() )
//_aggregate->addArticulation( createArticulationFromJoint(joint) );
else if( actor = serializable->is() ) {
_aggregate->addActor(*actor);
// the rest of the code to treat the actor
}
}
-------------------------------------
If I need to create and articulation then, how would you guys implement:
-----------------------------------
PxArticulation* createArticulationFromJoint( PxD6Joint* joint );
-------------------------------------
Many thanks in advance for the help.
Frank.