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

Method onAdd

Engine/source/T3D/groundPlane.cpp:124–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124bool GroundPlane::onAdd()
125{
126 if( !Parent::onAdd() )
127 return false;
128
129 if( isClientObject() )
130 _updateMaterial();
131
132 if( mSquareSize < sMIN_SQUARE_SIZE )
133 {
134 Con::errorf( "GroundPlane - squareSize below threshold; re-setting to %.02f", sMIN_SQUARE_SIZE );
135 mSquareSize = sMIN_SQUARE_SIZE;
136 }
137
138 Parent::setScale( VectorF( 1.0f, 1.0f, 1.0f ) );
139 Parent::setTransform( MatrixF::Identity );
140 setGlobalBounds();
141 resetWorldBox();
142
143 addToScene();
144
145 if ( PHYSICSMGR )
146 {
147 PhysicsCollision *colShape = PHYSICSMGR->createCollision();
148 colShape->addPlane( PlaneF( Point3F::Zero, Point3F( 0, 0, 1 ) ) );
149
150 PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" );
151 mPhysicsRep = PHYSICSMGR->createBody();
152 mPhysicsRep->init( colShape, 0, 0, this, world );
153 }
154
155 return true;
156}
157
158void GroundPlane::onRemove()
159{

Callers

nothing calls this directly

Calls 8

errorfFunction · 0.50
PlaneFClass · 0.50
Point3FClass · 0.50
createCollisionMethod · 0.45
addPlaneMethod · 0.45
getWorldMethod · 0.45
createBodyMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected