MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setMountNode

Method setMountNode

Engine/source/gui/editor/guiShapeEdPreview.cpp:613–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613void GuiShapeEdPreview::setMountNode(S32 mountSlot, const char* nodeName)
614{
615 if ( mountSlot < mMounts.size() )
616 {
617 MountedShape* mount = mMounts[mountSlot];
618
619 mount->mNode = mModel ? mModel->getShape()->findNode( nodeName ) : -1;
620 mount->mTransform.identity();
621
622 switch ( mount->mType )
623 {
624 case MountedShape::Image:
625 {
626 // Mount point is either the node called 'mountPoint' or the origin
627 S32 node = mount->mShape->getShape()->findNode( "mountPoint" );
628 if ( node != -1 )
629 {
630 mount->mShape->getShape()->getNodeWorldTransform( node, &mount->mTransform );
631 mount->mTransform.inverse();
632 }
633 }
634 break;
635
636 case MountedShape::Wheel:
637 // Rotate shape according to node's x position (left or right)
638 {
639 F32 rotAngle = M_PI_F/2;
640 if ( mount->mNode != -1 )
641 {
642 MatrixF hubMat;
643 mModel->getShape()->getNodeWorldTransform( mount->mNode, &hubMat );
644 if ( hubMat.getPosition().x < 0 )
645 rotAngle = -M_PI_F/2;
646 }
647 mount->mTransform.set( EulerF( 0, 0, rotAngle ) );
648 }
649 break;
650
651 default:
652 // No mount transform (use origin)
653 break;
654 }
655 }
656}
657
658const char* GuiShapeEdPreview::getMountThreadSequence(S32 mountSlot) const
659{

Callers 1

Calls 8

getNodeWorldTransformMethod · 0.80
sizeMethod · 0.45
findNodeMethod · 0.45
getShapeMethod · 0.45
identityMethod · 0.45
inverseMethod · 0.45
getPositionMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected