HitBox resource help.

Expanding and utilizing the engine via C++.
22 posts Page 3 of 3
irei1as
Posts: 73
Joined: Fri Feb 27, 2015 5:13 pm
by irei1as » Fri Feb 02, 2018 11:34 am
I think the problem comes from mixing collision and nodes (armature bone is a kind of node).
See, when looking for a node transform you get the root value and not the position it should take from the current animation.

I think that can be fixed using in the server
mShapeInstance->animateNodeSubtrees(true)
but I'm not really sure if that can be used in this resource. I'm still stuck with 3.8 so I can't help right now, sorry.
Also, no idea what are the side effects... If anybody knows a detriment of its use I would be grateful to know, thanks.

If you want to check if this is your issue, make a model being a single bone going up and down. Then attach the col-mesh to it and try the cast ray a)aiming to the visible position of the animated bone and b)aiming to where the bone is at the root.

As an extra, this is the code I've for the node experiments. Feel free to use it if you find it useful (but, not sure if it's usable for the new versions).

Code: Select all

Inside source/T3D/shapeBase.h add before the end of the definition of class ShapeBase:

public:
   MatrixF getNodeTransformN(const String &nodeName);
   MatrixF getNodeTransform(const S32 nodeIdx);

   
Inside source/T3D/shapeBase.cpp just at the end:


MatrixF ShapeBase::getNodeTransformN(const String &nodeName) 

   S32 nodeIdx = mShapeInstance->getShape()->findNode(nodeName); 
 
   return getNodeTransform(nodeIdx); 

 
MatrixF ShapeBase::getNodeTransform(const S32 nodeIdx) 

   MatrixF returnValue = MatrixF::Identity;
   if(nodeIdx != -1) 
   { 
      if (isServerObject() && mShapeInstance) 
         mShapeInstance->animateNodeSubtrees(true); 
     
      returnValue = mShapeInstance->mNodeTransforms[nodeIdx];
   } 
 
   MatrixF objectTransform = getTransform();
   
   Point3F nodeObjPos = returnValue.getPosition();
   nodeObjPos.convolve( getScale() );
   returnValue.setPosition(nodeObjPos);
   
   returnValue.mulL(objectTransform);
   
   return returnValue;


DefineEngineMethod( ShapeBase, getNodeTransform, TransformF, (const char* nodeName),,
   "Get the transform of a named node in the shape.\n"
   "@param nodeName Name of the node to check.\n"
   "@return The current transform of the node.\n" )
{
   return TransformF(object->getNodeTransformN(nodeName)); 
}

---------------------------------------------------------------------------------------------------------------------


In source\T3D\shapeImage.cpp look inside of
void ShapeBase::getMountTransform( S32 index, const MatrixF &xfm, MatrixF *outMat )
for
         MatrixF mountTransform = mShapeInstance->mNodeTransforms[ni];
And add these lines before:

         if (isServerObject() && mShapeInstance) 
            mShapeInstance->animateNodeSubtrees(true); 
         
oXYnary
Posts: 8
Joined: Fri Feb 20, 2015 11:08 pm
by oXYnary » Mon Feb 05, 2018 12:48 am
LoLJester wrote:@Azaezel: Were you able to get some information from your artist on how he set-up that character? What software did he export the model from and in what format? Is there a specific set-up that the model has to have? I believe the problem stems from how the character is exported to T3D. By the way, I'm using T3D 1.2, but I don't think that should matter.


3DS Max using the OpenCollada plugin.
https://github.com/KhronosGroup/OpenCOLLADA
22 posts Page 3 of 3

Who is online

Users browsing this forum: No registered users and 3 guests