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

Method getGroundAt

Engine/source/forest/editor/forestBrushTool.cpp:661–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661bool ForestBrushTool::getGroundAt( const Point3F &worldPt, F32 *zValueOut, VectorF *normalOut )
662{
663 const U32 mask = TerrainObjectType | StaticShapeObjectType;
664
665 Point3F start( worldPt.x, worldPt.y, worldPt.z + mSize );
666 Point3F end( worldPt.x, worldPt.y, worldPt.z - mSize );
667
668 if ( mForest )
669 mForest->disableCollision();
670
671 // Do a cast ray at this point from the top to
672 // the bottom of our brush radius.
673
674 RayInfo rinfo;
675 bool hit = gServerContainer.castRay( start, end, mask, &rinfo );
676
677 if ( mForest )
678 mForest->enableCollision();
679
680 if ( !hit )
681 return false;
682
683 if (zValueOut)
684 *zValueOut = rinfo.point.z;
685
686 if (normalOut)
687 *normalOut = rinfo.normal;
688
689 return true;
690}
691
692DefineEngineMethod( ForestBrushTool, collectElements, void, (), , "" )
693{

Callers

nothing calls this directly

Calls 3

disableCollisionMethod · 0.45
castRayMethod · 0.45
enableCollisionMethod · 0.45

Tested by

no test coverage detected