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

Method setCameraObject

Engine/source/T3D/gameBase/gameConnection.cpp:600–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600void GameConnection::setCameraObject(GameBase *obj)
601{
602 if(mCameraObject == obj)
603 return;
604
605 if(mCameraObject && mCameraObject != mControlObject)
606 mCameraObject->setControllingClient(0);
607
608 if(obj)
609 {
610 // nothing else is permitted to control this object
611 if(GameBase *coo = obj->getControllingObject())
612 coo->setControlObject(0);
613
614 if(GameConnection *con = obj->getControllingClient())
615 {
616 if(this != con)
617 {
618 // was it controlled via camera or control
619 if(con->getControlObject() == obj)
620 con->setControlObject(0);
621 else
622 con->setCameraObject(0);
623 }
624 }
625
626 // we are now the controlling client of this object
627 obj->setControllingClient(this);
628 }
629
630 // Okay, set our camera object.
631 mCameraObject = obj;
632
633 if(mCameraObject.isNull())
634 setScopeObject(mControlObject);
635 else
636 {
637 setScopeObject(mCameraObject);
638
639 // if this is a client then set the fov and active image
640 if(isConnectionToServer())
641 {
642 F32 fov = mCameraObject->getDefaultCameraFov();
643 //GameSetCameraFov(fov);
644 smFovUpdate.trigger(fov);
645 }
646 }
647
648}
649
650GameBase* GameConnection::getCameraObject()
651{

Callers 4

setCameraMethod · 0.80
setCameraMethod · 0.80
setControlObjectMethod · 0.80
gameConnection.cppFile · 0.80

Calls 8

setControllingClientMethod · 0.45
getControllingObjectMethod · 0.45
setControlObjectMethod · 0.45
getControllingClientMethod · 0.45
getControlObjectMethod · 0.45
isNullMethod · 0.45
getDefaultCameraFovMethod · 0.45
triggerMethod · 0.45

Tested by

no test coverage detected