Example #1
0
        public override void OnRMouse(bool shift)
        {
            if (heldInteract == null)
            {
                // create new interactable and set its size to some random scale
                GameObject   created  = Instantiate(createdObject, targetPos, Quaternion.identity, creationParent);
                Vector3      scale    = new Vector3(RandomSize(), RandomSize(), RandomSize());
                Interactable interact = created.GetComponent <Interactable>();

                interact.ChangeScale(scale);
                Feedback(string.Format("Created cuboid with size ({0}, {1}, {2}) and mass {3}", scale.x, scale.y, scale.z, interact.attachedRigidBody.mass.ToString()));
            }
            else
            {
                // delete held interactable
                heldInteract.Unhold();
                Destroy(heldInteract.gameObject);
                targetDistance = defaultDistance;
                heldInteract   = null;
                Feedback("Destroyed held interactable");
            }
        }