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

Method updateWeight

Engine/source/Verve/VPath/VPathEditor.cpp:631–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629}
630
631void VPathEditor::updateWeight( const Gui3DMouseEvent &pEvent )
632{
633 if ( !isEditingWeight() )
634 {
635 // Woops!
636 return;
637 }
638
639 // Fetch Current Node.
640 VPathNode *node = mSelection.Path->getNode( mSelection.Node );
641 Point3F nodePos = node->getWorldPosition();
642
643 // Fetch Node Transform.
644 MatrixF mat = node->getWorldTransform();
645
646 // Fetch the Normal.
647 const VectorF planeNormal = mat.getColumn3F( 0 );
648
649 // Construct Plane.
650 const PlaneF plane( nodePos, planeNormal );
651
652 Point3F iPt;
653 if ( plane.intersect( pEvent.pos, pEvent.vec, &iPt ) )
654 {
655/*
656 // Fetch Edit Vector.
657 VectorF tangentVect( mSelection.TangentHandle[mEditWeightHandle] - nodePos );
658 tangentVect.normalize();
659
660 // Fetch Mouse Vector.
661 VectorF mouseVec( iPt - nodePos );
662 F32 mouseDist = mouseVec.len();
663 mouseVec.normalize();
664
665 // Find the Angles.
666 F32 tangentAngle = mAtan2( -tangentVect.z, tangentVect.x );
667 F32 mouseAngle = mAtan2( -mouseVec.z, mouseVec.x );
668
669 // Determine Sign.
670 const S32 sign = ( planeNormal.y > 0.f ) ? -1.f : 1.f;
671
672 // Delta Rotation..
673 const QuatF deltaRotation( AngAxisF( planeNormal, sign * ( mouseAngle - tangentAngle ) ) );
674
675 // Calculate New Rotation.
676 QuatF newRotation;
677 newRotation.mul( nodePos, deltaRotation );
678
679 // Apply Rotation.
680 setNodeRotation( mSelection.Node, newRotation );
681*/
682/*
683 // Fetch Edit Vector.
684 VectorF handleVec( mSelection.TangentHandle[mEditWeightHandle] - nodePos );
685 handleVec.normalize();
686
687 // Fetch Mouse Vector.
688 VectorF mouseVec( iPt - nodePos );

Callers

nothing calls this directly

Calls 6

getColumn3FMethod · 0.80
getNodeMethod · 0.45
getWorldPositionMethod · 0.45
getWorldTransformMethod · 0.45
intersectMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected