void OnMouseUp() { if (!gravity_mode && save_mode && (save_obj != null)) { Debug.Log("store data!"); StoreData(save_obj); // Delete object data from the previously mapped object if (mapped_obj != null) { DeleteData(mapped_obj); } mapped_obj = save_obj; } else if (gravity_mode && (save_obj != null)) { Debug.Log("save mode set for container"); save_mode = true; colid.isTrigger = false; colid.attachedRigidbody.useGravity = true; } dragging = false; boundbox = save_obj.GetComponentInParent <DimBoxes.BoundBox>(); if (boundbox != null) { boundbox.UnableBox(); } colid.attachedRigidbody.velocity = Vector3.zero; //Debug.Log(colid.attachedRigidbody.velocity); Debug.Log("mouse up!"); }
private void OnTriggerExit(Collider other) { Debug.Log("trigger exit"); if (other.gameObject.tag != "Container" && other.gameObject.tag != "photo_object") { Transform p = other.gameObject.transform.parent; if (p == null || p.gameObject.tag != "Container") { save_mode = false; is_colliding = false; Debug.Log("save mode exit"); if (dragging) { boundbox = other.gameObject.GetComponentInParent <DimBoxes.BoundBox>(); if (boundbox != null) { boundbox.UnableBox(); } } if (mapped_obj != null) { DeleteData(mapped_obj); } mapped_obj = null; } } if (other.gameObject.name == "gravity_field" && gravity_mode == true) { Debug.Log("gravity mode exit"); gravity_mode = false; save_mode = false; colid.isTrigger = true; colid.attachedRigidbody.useGravity = false; is_colliding = false; if (dragging) { boundbox = other.gameObject.GetComponentInParent <DimBoxes.BoundBox>(); if (boundbox != null) { boundbox.UnableBox(); } } if (mapped_obj != null) { DeleteData(mapped_obj); } mapped_obj = null; } }