VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Avatar.AVR_PoseAssumer.OnAnimatorIK ( int  layerIndex)
inlineprivate

Definition at line 181 of file AVR_PoseAssumer.cs.

182  {
183  IKPass_is_enabled = true;
184 
185  #if AVR_NET
186  if (!playerRig) return; // Sometimes this happens on MP for one frame.
187  #endif
188 
189  setPosRot(layerIndex);
190 
191  // This paragraph handles everything regarding basic movement animations and stuff
192  if(autoLayerBlend) {
193  animator.SetFloat(speedAnimationParameter, playerRig.AvgMotion.magnitude);
194  animator.SetLayerWeight(layerIndex, layerBlend);
195  Vector3 defaultBodyPos = transform.TransformPoint(provider.pivotPos + Vector3.up * 1.0f);
196  animator.bodyPosition = Vector3.Lerp(defaultBodyPos, animator.bodyPosition, layerBlend);
197  animator.bodyRotation = Quaternion.Lerp(
198  // The 0.0001*forward is to avoid quaternion zero-look errors. These don't actually break anything, but they do spam the debug output.
199  transform.rotation * Quaternion.LookRotation(playerRig.AvgMotion + 0.0001f*Vector3.forward, Vector3.up),
200  animator.bodyRotation,
201  layerBlend
202  );
203  }
204 
205  setWeights(layerIndex);
206  }
void setPosRot(int layerIndex)
void setWeights(int layerIndex)
string speedAnimationParameter
The animation parameter in the animation controller we set to the playerrigs speed when the rig is te...
AVR_PlayerRig playerRig
The current AVR_PlayerRig instance in the scene
bool autoLayerBlend
If true, we automatically blend the weight of the IK layer to inverse proportion of the playerRigs' s...