// Resets camera to behind target object void TetherCamera::reset() { Vector3 target; float targetHeading; assert(m_objects); // object manager doesn't exist GameObject* obj = m_objects->getObjectPointer(m_targetObjectID); assert(obj); // object to follow doesn't exist targetHeading = obj->getOrientation().heading; target = obj->getPosition(); target.y += 3.0f; cameraOrient.set(targetHeading, 0.0f,0.0f); RotationMatrix cameraMatrix; cameraMatrix.setup(cameraOrient); Vector3 bOffset(0.0f,0.0f, -maxDist); Vector3 iOffset = cameraMatrix.objectToInertial(bOffset); cameraPos = target + iOffset; }
void BlockMap::ResetConnectivity() { for (int r = 0; r < Rows(); r++) { for (int c = 0; c < Cols(); c++) { Block& currBlock = m_BlockMatrix[r][c]; // Set reachable neighbors currBlock.neighborOffsets.clear(); Vector2 lOffset(0, -1); Vector2 rOffset(0, 1); Vector2 tOffset(-1, 0); Vector2 bOffset(1, 0); if (ValidCoord(currBlock.coord + lOffset)) currBlock.neighborOffsets.insert(lOffset); if (ValidCoord(currBlock.coord + rOffset)) currBlock.neighborOffsets.insert(rOffset); if (ValidCoord(currBlock.coord + tOffset)) currBlock.neighborOffsets.insert(tOffset); if (ValidCoord(currBlock.coord + bOffset)) currBlock.neighborOffsets.insert(bOffset); } } }