actor for each bone

nasirus1983

10-03-2009 13:26:20

Hi,

I've got a small problem with calculating actors positions and orientations for bones.
I've refresh method which geting current position of bones and setting it to actors. But it isn't working quite well.
This is my code:

void CEntity::refresh(Real timeSinceLastFrame)
{
if ((isBone) && (!entityName.empty()))
{
Entity* ent = (Entity*) mSceneMgr->getSceneNode(sceneNodeName)->getAttachedObject(entityName);
Vector3 position = ent->getSkeleton()->getBone(actorName)->_getDerivedPosition();
Quaternion orient = ent->getSkeleton()->getBone(actorName)->_getDerivedOrientation();

//position = position - length;

physicActor->moveGlobalPosition(Utils::toNxVec3(position));
physicActor->moveGlobalOrientationQuat(Utils::toNxQuat(orient));
}
}


I think, that position of actor should be something like:

physicActor->moveGlobalPosition(ent->getSkeleton()->getBone(actorName)->_getDerivedPosition() + mSceneMge->getSceneNode(sceneNodeName)->getPosition();


But I'm not sure. The same problem I've with setting orientation.

nargil

10-03-2009 13:36:52

What .mesh are you using ? Caphalor has made some progress with ragdolls and it works... at least for the jaiqua.mesh. The robot and ninja meshes have some problems with bone orientation. It would be a good idea to check it out with an own boned mesh. Look at viewtopic.php?f=6&t=9277

Anyway even though the ragdoll isn't accurate for the robot.mesh it works quite good:
http://www.youtube.com/watch?v=5our--c-CBw