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

Method getPointOnPath

Engine/source/Verve/VPath/VPathEditor.cpp:785–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783//-----------------------------------------------------------------------------
784
785bool VPathEditor::getPointOnPath( VPath *pPath, const Gui3DMouseEvent &pEvent, S32 &pNode, MatrixF &pTransform )
786{
787 if ( pPath->getNodeCount() < 2 )
788 {
789 // Start / End Points.
790 const Point3F pt0 = pEvent.pos;
791 const Point3F pt1 = pEvent.pos + pEvent.vec * gProjectDistance;
792
793 // Create Intersection Plane.
794 const PlaneF plane( pPath->getPosition(), VPath::gBezierUp );
795
796 // Intersection Point.
797 Point3F intersectionPoint;
798 if ( !plane.intersect( pEvent.pos, pEvent.vec, &intersectionPoint ) )
799 {
800 // No Intersection.
801 return false;
802 }
803
804 // I'th Node.
805 pNode = pPath->getNodeCount();
806 // Set Identity.
807 pTransform.identity();
808 // Set Position.
809 pTransform.setPosition( intersectionPoint );
810
811 // Return.
812 return true;
813 }
814
815 switch ( pPath->mPathType )
816 {
817 case VPath::k_PathLinear :
818 {
819
820 return getPointOnLinearPath( pPath, pEvent, pNode, pTransform );
821
822 } break;
823
824 case VPath::k_PathBezier :
825 {
826
827 return getPointOnBezierPath( pPath, pEvent, pNode, pTransform );
828
829 } break;
830 }
831
832 return false;
833}
834
835bool VPathEditor::getPointOnLinearPath( VPath *pPath, const Gui3DMouseEvent &pEvent, S32 &pNode, MatrixF &pTransform )
836{

Callers

nothing calls this directly

Calls 5

getNodeCountMethod · 0.45
getPositionMethod · 0.45
intersectMethod · 0.45
identityMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected