VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
virtual IEnumerator AVR.Phys.AVR_OffsetGrabProvider.setHand ( )
inlineprotectedvirtual

Reimplemented in AVR.Phys.AVR_AdvancedOffsetGrabProvider.

Definition at line 110 of file AVR_OffsetGrabProvider.cs.

111  {
112  handVisual.disableColliders();
113  // Wait a bit to ensure at least 1 physics-frame has passed
114  yield return new WaitForSecondsRealtime(Time.fixedDeltaTime + 0.01f);
115  // Wait until the object is close enough
116  yield return new WaitUntil(() => Vector3.Distance(grabbedObject.transform.position, getTargetPosition()) < 0.05f); //TODO: grabbedObject == null?
117 
118  //TODO: disable hand colliders if the hand is physical
119 
120  if(grabLocation.isNode) {
121  handVisual.ApplyNodePose(grabLocation.node);
122  }
123  else
124  {
125  handVisual.SqueezeOn(grabbedObject);
126  handVisual.SetSqueezeWeight(1.0f);
127  }
128  handVisual.SetFakeParent(grabbedObject.transform);
129  }
override Vector3 getTargetPosition()
Target position the grabbed object should "strive" towards in world coordiantes. There will be force ...
AVR_Grabbable grabbedObject
Object that is currently being grabbed. Null if no object is being grabbed