void SceneObject::setHidden( bool hidden ) { if( hidden != isHidden() ) { // Add/remove the object from the scene. Removing it // will also cause the NetObject to go out of scope since // the container query will not find it anymore. However, // ScopeAlways objects need to be treated separately as we // do next. if( !hidden ) addToScene(); else removeFromScene(); // ScopeAlways objects stay in scope no matter what, i.e. even // if they aren't in the scene query anymore. So, to force ghosts // to go away, we need to clear ScopeAlways while we are hidden. if( hidden && mIsScopeAlways ) clearScopeAlways(); else if( !hidden && mIsScopeAlways ) setScopeAlways(); Parent::setHidden( hidden ); } }
bool PathCamera::onAdd() { if(!Parent::onAdd()) return false; // Initialize from the current transform. if (!mNodeCount) { QuatF rot(getTransform()); Point3F pos = getPosition(); mSpline.removeAll(); mSpline.push_back(new CameraSpline::Knot(pos,rot,1, CameraSpline::Knot::NORMAL, CameraSpline::Knot::SPLINE)); mNodeCount = 1; } // mObjBox.maxExtents = mObjScale; mObjBox.minExtents = mObjScale; mObjBox.minExtents.neg(); resetWorldBox(); if (mShapeInstance) { mNetFlags.set(Ghostable); setScopeAlways(); } addToScene(); return true; }
void LineItem::onAddedToGame(Game *game) { Parent::onAddedToGame(game); if(!isGhost()) setScopeAlways(); }
void NexusZone::onAddedToGame(Game *theGame) { Parent::onAddedToGame(theGame); if(!isGhost()) setScopeAlways(); // Always visible! GameType *gameType = getGame()->getGameType(); if(gameType && gameType->getGameTypeId() == NexusGame) static_cast<NexusGameType *>(gameType)->addNexus(this); }
U32 RigidBody::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { U32 retMask = Parent::packUpdate(con, mask, stream); bool hasServerPhysics = !Physics::getPhysics(false) && con->isLocalConnection(); //set hasServerPhysic flag if ((mask&InitialUpdateMask)) { if (!hasServerPhysics && mDataBlock->mOnlyOnClient) { setScopeAlways(); } } //special cases: if (stream->writeFlag((mask&InitialUpdateMask) && (hasServerPhysics || mDataBlock->mOnlyOnClient))) { if (stream->writeFlag(hasServerPhysics)) { PhysShape* shape = mPhysShape; stream->writeBits(8*sizeof(shape),&shape); } else { mathWrite(*stream,getTransform()); } } if (stream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask))) { return retMask; } if (!hasServerPhysics && !mDataBlock->mOnlyOnClient && stream->writeFlag(mask & PositionMask)) { /* VectorF linVel = mPhysShape->getLinVelocity(); VectorF force = mPhysShape->getForce(); Con::printf("Pack vel: %f %f %f momentum: %f %f %f ",linVel.x,linVel.y,linVel.z, force.x, force.y, force.z);*/ mPhysShape->pack(stream); } return retMask; }