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

Method getGridPos

Engine/source/terrain/terrData.cpp:620–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618
619
620Point2I TerrainBlock::getGridPos( const Point3F &worldPos ) const
621{
622 Point3F terrainPos = worldPos;
623 getWorldTransform().mulP( terrainPos );
624
625 F32 squareSize = ( F32 ) getSquareSize();
626 F32 halfSquareSize = squareSize / 2.0;
627
628 F32 x = ( terrainPos.x + halfSquareSize ) / squareSize;
629 F32 y = ( terrainPos.y + halfSquareSize ) / squareSize;
630
631 Point2I gridPos( ( S32 ) mFloor( x ), ( S32 ) mFloor( y ) );
632 return gridPos;
633}
634
635void TerrainBlock::updateGrid( const Point2I &minPt, const Point2I &maxPt, bool updateClient )
636{

Callers 1

worldToGridMethod · 0.80

Calls 3

getWorldTransformFunction · 0.85
mFloorFunction · 0.85
mulPMethod · 0.80

Tested by

no test coverage detected