mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-22 05:34:46 +00:00
new method tsstatic.getNodeTransform
used to look up a given node's transform by explicit name in a tsstatic object
This commit is contained in:
parent
e372545cc6
commit
19e4643707
|
|
@ -54,6 +54,7 @@
|
|||
#include "materials/materialFeatureTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "T3D/accumulationVolume.h"
|
||||
#include "math/mTransform.h"
|
||||
|
||||
#include "gui/editor/inspector/group.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
|
@ -1863,3 +1864,31 @@ void TSStatic::setSelectionFlags(U8 flags)
|
|||
}
|
||||
}
|
||||
|
||||
void TSStatic::getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat)
|
||||
{
|
||||
|
||||
S32 nodeIDx = getShapeResource()->findNode(nodeName);
|
||||
|
||||
MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIDx];
|
||||
mountTransform.mul(xfm);
|
||||
const Point3F &scale = getScale();
|
||||
// The position of the mount point needs to be scaled.
|
||||
Point3F position = mountTransform.getPosition();
|
||||
position.convolve(scale);
|
||||
mountTransform.setPosition(position);
|
||||
// Also we would like the object to be scaled to the model.
|
||||
outMat->mul(mObjToWorld, mountTransform);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod(TSStatic, getNodeTransform, TransformF, (const char *nodeName), ,
|
||||
"@brief Get the world transform of the specified mount slot.\n\n"
|
||||
|
||||
"@param slot Image slot to query\n"
|
||||
"@return the mount transform\n\n")
|
||||
{
|
||||
MatrixF xf(true);
|
||||
object->getNodeTransform(nodeName, MatrixF::Identity, &xf);
|
||||
return xf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ public:
|
|||
void updateMaterials();
|
||||
|
||||
bool isAnimated() { return mPlayAmbient; }
|
||||
void getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat);
|
||||
|
||||
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue