Required changes for Inverse Kinematics

Added a * operator
compute from to -> adds safeties around shortestArc
conjugate -> reverses the xyz of the quaternion

IK Solver commit

Added: IKChain struct to tsshape
commands to tsshapeconstruct to create and setup ikchains
ik solvers -> ccd and fabrik, these are in their own file tsIKSolver

TODO: there needs to be some tooling added to the shape editor for this
This commit is contained in:
marauder2k7 2025-12-04 08:29:44 +00:00
parent 42e8687067
commit 9866908e99
10 changed files with 1048 additions and 1 deletions

View file

@ -101,6 +101,7 @@ TSShape::TSShape()
VECTOR_SET_ASSOCIATION(billboardDetails);
VECTOR_SET_ASSOCIATION(detailCollisionAccelerators);
VECTOR_SET_ASSOCIATION(names);
VECTOR_SET_ASSOCIATION(ikChains);
VECTOR_SET_ASSOCIATION( nodes );
VECTOR_SET_ASSOCIATION( objects );
@ -203,6 +204,17 @@ const String& TSShape::getSequenceName( S32 seqIndex ) const
return names[nameIdx];
}
const String& TSShape::getIKChainName(S32 ikIndex) const
{
AssertFatal(ikIndex >= 0 && ikIndex < ikChains.size(), "TSShape::getIKChainName index beyond range");
S32 nameIdx = ikChains[ikIndex].nameIndex;
if (nameIdx < 0)
return String::EmptyString;
return names[nameIdx];
}
S32 TSShape::findName(const String &name) const
{
for (S32 i=0; i<names.size(); i++)
@ -269,6 +281,14 @@ S32 TSShape::findSequence(S32 nameIndex) const
return -1;
}
S32 TSShape::findIKChain(S32 nameIndex) const
{
for (S32 i = 0; i < ikChains.size(); i++)
if (ikChains[i].nameIndex == nameIndex)
return i;
return -1;
}
bool TSShape::findMeshIndex(const String& meshName, S32& objIndex, S32& meshIndex)
{
// Determine the object name and detail size from the mesh name