private void ResetDropSnapType() { switch (storedSnapDropZone.snapType) { case VRTK_SnapDropZone.SnapTypes.Use_Kinematic: case VRTK_SnapDropZone.SnapTypes.Use_Parenting: LoadPreviousState(); break; case VRTK_SnapDropZone.SnapTypes.Use_Joint: var snapDropZoneJoint = storedSnapDropZone.GetComponent <Joint>(); if (snapDropZoneJoint) { snapDropZoneJoint.connectedBody = null; } break; } if (!previousLocalScale.Equals(Vector3.zero)) { transform.localScale = previousLocalScale; } storedSnapDropZone.OnObjectUnsnappedFromDropZone(storedSnapDropZone.SetSnapDropZoneEvent(gameObject)); storedSnapDropZone = null; }
private void SetSnapDropZoneJoint(VRTK_SnapDropZone snapDropZone, Rigidbody snapTo) { var snapDropZoneJoint = snapDropZone.GetComponent <Joint>(); if (snapDropZoneJoint == null) { Debug.LogError("No Joint Component was found on the SnapDropZone GameObject yet the Snap Type is set to `Use Joint`. Please manually add a joint to the SnapDropZone GameObject."); return; } snapDropZoneJoint.connectedBody = snapTo; }