| 122 | } |
| 123 | |
| 124 | bool 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 | |
| 158 | void GroundPlane::onRemove() |
| 159 | { |
nothing calls this directly
no test coverage detected