public static string Receive() { ObjectCreationEvent fe = JsonUtility.FromJson <ObjectCreationEvent>(FlowNetworkManager.reply); FlowTObject obj = fe.obj; GameObject newObj = GameObject.CreatePrimitive(PrimitiveType.Cube); Mesh objMesh = newObj.GetComponent <MeshFilter>().mesh; objMesh.vertices = obj.vertices; objMesh.uv = obj.uv; objMesh.triangles = obj.triangles; objMesh.RecalculateBounds(); objMesh.RecalculateNormals(); newObj.transform.localPosition = new Vector3(obj.x, obj.y, obj.z); newObj.transform.localRotation = Quaternion.Euler(new Vector4(obj.q_x, obj.q_y, obj.q_z, obj.q_w)); newObj.transform.localScale = new Vector3(obj.s_x, obj.s_y, obj.s_z); MonoBehaviour.Destroy(newObj.GetComponent <Collider>()); newObj.AddComponent <BoxCollider>(); //Web newObj.AddComponent(typeof(MouseClick)); newObj.transform.SetParent(GameObject.FindGameObjectWithTag("ObjManager").transform); //Web newObj.name = obj.name; newObj.AddComponent(typeof(FlowObject)); /* * switch (Config.DEVICE_TYPE) * { * case FlowClient.CLIENT_HOLOLENS: * newObj.AddComponent(typeof(TwoHandManipulatable)); * newObj.AddComponent(typeof(BoundingBoxRig)); * * BoundingBox interactBox = (BoundingBox)Resources.Load("Prefabs/BoundingBoxBasic", typeof(BoundingBox)); * newObj.GetComponent<TwoHandManipulatable>().BoundingBoxPrefab = interactBox; * newObj.GetComponent<BoundingBoxRig>().BoundingBoxPrefab = interactBox; * * AppBar menuBar = (AppBar)Resources.Load("Prefabs/AppBar", typeof(AppBar)); * newObj.GetComponent<BoundingBoxRig>().AppBarPrefab = menuBar; * break; * } */ newObj.GetComponent <FlowObject>().selected = true; // might want to comment this one out Material mat = newObj.GetComponent <MeshRenderer>().material; mat.color = obj.color; //newObj.GetComponent<FlowObject>().Start(); newObj.GetComponent <FlowObject>().ft = new FlowTObject(newObj); newObj.GetComponent <FlowObject>().ft._id = obj._id; newObj.GetComponent <FlowObject>().ft.id = obj.id; newObj.GetComponent <FlowObject>().pastState = new FlowTObject(); newObj.GetComponent <FlowObject>().pastState.Copy(newObj.GetComponent <FlowObject>().ft); newObj.GetComponent <FlowObject>().ft.flowObject = newObj.GetComponent <FlowObject>(); //FlowProject.activeProject.RegObj(); //probably don't need this anymore return("Recieving Object Creation update: " + FlowNetworkManager.reply); }
public void Send(FlowTObject objToSend) { obj = objToSend; project = new FlowProject(); project._id = Config.projectId; CommandProcessor.sendCommand(this); }
public static string Receive() { ObjectDeleteEvent obj_delete_evt = JsonUtility.FromJson <ObjectDeleteEvent>(FlowNetworkManager.reply); FlowTObject objToDelete = FlowProject.activeProject.transformsById[obj_delete_evt.obj._id]; FlowProject.activeProject.transformsById.Remove(obj_delete_evt.obj._id); UnityEngine.Object.Destroy(objToDelete.transform.gameObject); return("Receiving Object Delete Update " + FlowNetworkManager.reply); }
public void Send(string id) { obj = new FlowTObject(); obj._id = id; project_id = Config.projectId; client_id = Config.deviceId; CommandProcessor.sendCommand(this); }
public void Send(FlowTObject transformToSend) { transformToSend.Read(); obj = new FlowTObject(); obj.Copy(transformToSend); project = new FlowProject(Config.projectId); client = new FlowClient(Config.deviceId); CommandProcessor.sendCommand(this); }
public bool Equals(FlowTObject fo) { if (x != fo.x || y != fo.y || z != fo.z || q_x != fo.q_x || q_y != fo.q_y || q_z != fo.q_z || s_x != fo.s_x || s_y != fo.s_y || s_z != fo.s_z || color != fo.color) { return(false); } return(true); }
public static string Receive() { ObjectUpdateEvent trans_update_cmd = JsonUtility.FromJson <ObjectUpdateEvent>(FlowNetworkManager.reply); FlowTObject local_transform = FlowProject.activeProject.transformsById[trans_update_cmd.obj._id]; //if (local_transform.flowObject.selected) // local_transform.flowObject.selected = false; local_transform.Copy(trans_update_cmd.obj); local_transform.Update(); local_transform.flowObject.pastState.Copy(local_transform); return("Receiving Transform update: " + FlowNetworkManager.reply); }
public void Copy(FlowTObject source) { x = source.x; y = source.y; z = source.z; q_x = source.q_x; q_y = source.q_y; q_z = source.q_z; q_w = source.q_w; s_x = source.s_x; s_y = source.s_y; s_z = source.s_z; _id = source._id; color = source.color; //vertices = source.mesh.vertices; //uv = source.mesh.uv; //triangles = source.mesh.triangles; //name = source.name; //type = "BoxCollider"; }
public FlowTransformPayload(FlowTObject init) { data = init; }
public FlowTransformPayload(string _tid) { data = new FlowTObject(_tid); }