public static void CallBack(ROSBridgeMsg msg) { EnvironmentMsg poseMsg = (EnvironmentMsg)msg; if (poseMsg.id_.Contains("hoop")) { char numID = poseMsg.id_[poseMsg.id_.Length - 1]; //Debug.Log("Got a tf message: " + poseMsg.id_[poseMsg.id_.Length - 1]); GameObject currentHoop = null; GameObject hoopLabel = null; if (!WorldScript.hoopsDict.ContainsKey(numID)) { GameObject world = GameObject.FindWithTag("World"); currentHoop = Object.Instantiate(world.GetComponent <WorldScript>().torus); currentHoop.transform.parent = world.transform; WorldScript.hoopsDict[numID] = currentHoop; Debug.Log("Made hoop with id: " + numID); } else { currentHoop = WorldScript.hoopsDict[numID]; } currentHoop.transform.localPosition = WorldScript.RosSpaceToWorldSpace(poseMsg.x_, poseMsg.y_, poseMsg.z_) + new Vector3(0.31f, 0f, 0f); currentHoop.transform.localScale = new Vector3(3.3f, 3.3f, 3.3f); currentHoop.transform.localRotation = new Quaternion(poseMsg.x_rot_ + 1, poseMsg.y_rot_, poseMsg.z_rot_, poseMsg.w_rot_); } }