VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Phys.AVR_Grabbable.Release ( AVR_BasicGrabProvider  hand)
inline

Definition at line 140 of file AVR_Grabbable.cs.

141  {
142  #if AVR_NET
143  if (IsOnline) NetworkObject.RemoveOwnership();
144  #endif
145 
146  if(AttachedHands.Contains(hand)) AttachedHands.Remove(hand);
147  if(AttachedHands.Count<1) {
148  transform.SetParent(old_parent);
149  if(velocities.Count>0) rb.velocity = new Vector3(velocities.Average(v => v.x), velocities.Average(v => v.y), velocities.Average(v => v.z));
150  velocities.Clear();
151 
152  //Play release sound
153  if (source != null && objectType.soundData.releaseSound != null)
154  {
155  source.PlayOneShot(objectType.soundData.releaseSound, objectType.soundData.volumeMultiplier);
156  }
157  }
158  }
AudioSource source
Optional AudioSource to play sounds from GrabbableObjectType data
List< AVR_BasicGrabProvider > AttachedHands
List of hands that are currently grabbing this object.
GrabbableObjectType objectType
Type that describes the objects behaviour when grabbed.
List< Vector3 > velocities
GrabbableObjectSoundData soundData