FVector ARobot::getBallPosition() { FVector returnvalue = FVector(0, 0, 0); if (ball != nullptr) { if (isObjectVisible(ball->getLocation())) { returnvalue = ball->getLocation(); } } return returnvalue; }
TArray<RobotDataTypes::PlayerLocation>* ARobot::getVisiblePlayers() { FVector ownLocation = GetActorLocation(); FRotator ownRotation = GetActorRotation(); TArray<RobotDataTypes::PlayerLocation>* visiblePlayerLocations = new TArray<RobotDataTypes::PlayerLocation>(); //Iterate through all Robots for (TActorIterator<ARobot> ActorItr(GetWorld()); ActorItr; ++ActorItr) { ARobot* robot = Cast<ARobot>(*ActorItr); if (this == robot) continue; if (isObjectVisible(robot->getPosition())) { visiblePlayerLocations->Add(RobotDataTypes::PlayerLocation{ robot->getTeamId(), robot->getPlayerId(), new FVector(robot->getPosition()) }); } } return visiblePlayerLocations; }
bool CHelicopter::isVisible (CScriptGameObject* O) { return isObjectVisible (&O->object()); }
void liqWriteArchive::writeObjectToRib(const MDagPath &objDagPath, bool writeTransform) { if (!isObjectVisible(objDagPath)) { return; } if (debug) { cout << "liquidWriteArchive: writing object: " << objDagPath.fullPathName().asChar() << endl; } if (objDagPath.node().hasFn(MFn::kShape) || MFnDagNode( objDagPath ).typeName() == "liquidCoorSys") { // we're looking at a shape node, so write out the geometry to the RIB outputObjectName(objDagPath); liqRibNode ribNode; ribNode.set(objDagPath, 0, MRT_Unknown); // don't write out clipping planes if ( ribNode.object(0)->type == MRT_ClipPlane ) return; if ( ribNode.rib.box != "" && ribNode.rib.box != "-" ) { RiArchiveRecord( RI_COMMENT, "Additional RIB:\n%s", ribNode.rib.box.asChar() ); } if ( ribNode.rib.readArchive != "" && ribNode.rib.readArchive != "-" ) { // the following test prevents a really nasty infinite loop !! if ( ribNode.rib.readArchive != outputFilename ) RiArchiveRecord( RI_COMMENT, "Read Archive Data: \nReadArchive \"%s\"", ribNode.rib.readArchive.asChar() ); } if ( ribNode.rib.delayedReadArchive != "" && ribNode.rib.delayedReadArchive != "-" ) { // the following test prevents a really nasty infinite loop !! if ( ribNode.rib.delayedReadArchive != outputFilename ) RiArchiveRecord( RI_COMMENT, "Delayed Read Archive Data: \nProcedural \"DelayedReadArchive\" [ \"%s\" ] [ %f %f %f %f %f %f ]", ribNode.rib.delayedReadArchive.asChar(), ribNode.bound[0], ribNode.bound[3], ribNode.bound[1], ribNode.bound[4], ribNode.bound[2], ribNode.bound[5]); } // If it's a curve we should write the basis function if ( ribNode.object(0)->type == MRT_NuCurve ) { RiBasis( RiBSplineBasis, 1, RiBSplineBasis, 1 ); } if ( !ribNode.object(0)->ignore ) { ribNode.object(0)->writeObject(); } } else { // we're looking at a transform node bool wroteTransform = false; if (writeTransform && (objDagPath.apiType() == MFn::kTransform)) { if (debug) { cout << "liquidWriteArchive: writing transform: " << objDagPath.fullPathName().asChar() << endl; } // push the transform onto the RIB stack outputObjectName(objDagPath); MFnDagNode mfnDag(objDagPath); MMatrix tm = mfnDag.transformationMatrix(); if (true) { // (!tm.isEquivalent(MMatrix::identity)) { RtMatrix riTM; tm.get(riTM); wroteTransform = true; outputIndentation(); RiAttributeBegin(); indentLevel++; outputIndentation(); RiConcatTransform(riTM); } } // go through all the children of this node and deal with each of them int nChildren = objDagPath.childCount(); if (debug) { cout << "liquidWriteArchive: object " << objDagPath.fullPathName().asChar() << "has " << nChildren << " children" << endl; } for(int i=0; i<nChildren; ++i) { if (debug) { cout << "liquidWriteArchive: writing child number " << i << endl; } MDagPath childDagNode; MStatus stat = MDagPath::getAPathTo(objDagPath.child(i), childDagNode); if (stat) { writeObjectToRib(childDagNode, outputChildTransforms); } else { MGlobal::displayWarning("error getting a dag path to child node of object " + objDagPath.fullPathName()); } } if (wroteTransform) { indentLevel--; outputIndentation(); RiAttributeEnd(); } } if (debug) { cout << "liquidWriteArchive: finished writing object: " << objDagPath.fullPathName().asChar() << endl; } }