MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / bindToCharacter

Method bindToCharacter

physx/samples/samplebase/SampleCharacterHelpers.cpp:537–560  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

535
536///////////////////////////////////////////////////////////////////////////////
537bool
538Skin::bindToCharacter(Character &character, SampleArray<PxVec4> &positions)
539{
540 // currently we just bind everything to the 'thorax' (between neck and clavicles).
541 // Modify this if you need to do more elaborate skin binding
542
543 mBindPos.resize(positions.size());
544 Acclaim::Bone* bone = getBoneFromName(*character.mASFData, "thorax");
545 if (bone == NULL)
546 return false;
547
548 PxTransform boneTransform = computeBoneTransformRest(*bone);
549 PxTransform boneTransformInv = boneTransform.getInverse();
550
551 mBoneID = bone->mID - 1;
552
553 for (PxU32 i = 0; i < positions.size(); i++)
554 {
555 mBindPos[i] = boneTransformInv.transform(
556 reinterpret_cast<const PxVec3&>(positions[i]));
557 }
558
559 return true;
560}
561
562///////////////////////////////////////////////////////////////////////////////
563bool

Callers

nothing calls this directly

Calls 6

computeBoneTransformRestFunction · 0.85
getBoneFromNameFunction · 0.70
resizeMethod · 0.45
sizeMethod · 0.45
getInverseMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected