### HitBox resource help.

Expanding and utilizing the engine via C++.

#### Re: HitBox resource help.

irei1as
Posts: 76
Joined: Fri Feb 27, 2015 5:13 pm
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); 

#### Re: HitBox resource help.

oXYnary
Posts: 8
Joined: Fri Feb 20, 2015 11:08 pm
@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.

#### Re: HitBox resource help.

Atomic Walrus
Posts: 6
Joined: Mon Feb 23, 2015 10:41 pm
Hello,

I need help with this resource on GG's website: http://www.garagegames.com/community/re ... view/6538/ and the ported one on GitHub: https://github.com/Azaezel/Torque3D/tre ... boxes_rev2

Only problem that I have with this resource is that, although the hitbox is recognized on preload, the rayCast won't hit (during runtime) a shape exported to COLLADA that has a "-1" (or any) level of detail mesh attached to an animated bone.
My hitbox is named HBa-1 and weighed to an animated head bone. I chose the "-1" level of detail so that the hitbox remains invisible during the game.
I know about the stock hitbox feature that uses the shape's divided bounding box as hitboxes, but it is not useful for big enemies that have one or two small vulnerable spots.
I use Unwrap3D to export to DAE or DTS.
Because of this line:
mShapeInstance->castRayEA(start, end, info,0,mDataBlock->HBIndex)
in player::castRay,
the hitboxes must always be in the highest (first) detail level. Detail zero, as passed in the function above before the hitbox index.

If you wanted to do something like define a specific detail size as the hitbox detail you would have to loop through the model's details, mShape->details (for (U32 i = 0; i < mShape->details.size(); i++)) testing mShape->details.size until you found the one you wanted to use, then send that detail level's index instead of zero. If you didn't want to run that loop on every raycast, you could search for and store the hitbox detail level index during preload.

Alternatively, I used to just make the boxes invisible with a material.

#### Re: HitBox resource help.

LoLJester
Posts: 65
Joined: Thu Aug 13, 2015 5:58 pm

Thanks Atomic Walrus; but, if you read above, that was not the problem. The problem seems to come from how the model is exported. It is CRUCIAL that the DAE or DTS exporter of the modeling program you use is FULLY compatible with the version of T3D you're using. I'm using Unwrap3D to export most of my models, but it is not 100% compatible with T3D. Instead, I used Milkshape3D's DTS Exporter Plus to export the models with HitBoxes. It works quite well, but not perfectly.

#### Who is online

Users browsing this forum: No registered users and 3 guests