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

Method setMountNode

Engine/source/gui/editor/guiShapeEdPreview.cpp:555–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555void GuiShapeEdPreview::setMountNode(S32 mountSlot, const char* nodeName)
556{
557 if ( mountSlot < mMounts.size() )
558 {
559 MountedShape* mount = mMounts[mountSlot];
560
561 mount->mNode = mModel ? mModel->getShape()->findNode( nodeName ) : -1;
562 mount->mTransform.identity();
563
564 switch ( mount->mType )
565 {
566 case MountedShape::Image:
567 {
568 // Mount point is either the node called 'mountPoint' or the origin
569 S32 node = mount->mShape->getShape()->findNode( "mountPoint" );
570 if ( node != -1 )
571 {
572 mount->mShape->getShape()->getNodeWorldTransform( node, &mount->mTransform );
573 mount->mTransform.inverse();
574 }
575 }
576 break;
577
578 case MountedShape::Wheel:
579 // Rotate shape according to node's x position (left or right)
580 {
581 F32 rotAngle = M_PI_F/2;
582 if ( mount->mNode != -1 )
583 {
584 MatrixF hubMat;
585 mModel->getShape()->getNodeWorldTransform( mount->mNode, &hubMat );
586 if ( hubMat.getPosition().x < 0 )
587 rotAngle = -M_PI_F/2;
588 }
589 mount->mTransform.set( EulerF( 0, 0, rotAngle ) );
590 }
591 break;
592
593 default:
594 // No mount transform (use origin)
595 break;
596 }
597 }
598}
599
600const char* GuiShapeEdPreview::getMountThreadSequence(S32 mountSlot) const
601{

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