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:
I think, that position of actor should be something like:
But I'm not sure. The same problem I've with setting orientation.
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.