VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Avatar.AVR_SimpleAvatar.Update ( )
inlineprivate

Definition at line 35 of file AVR_SimpleAvatar.cs.

36  {
37  if(!this.enabled) Debug.Log("????????????");
38 
39  animator.SetFloat(speedAnimationParameter, playerRig.AvgMotion.magnitude);
40 
41  if(playerRig.AvgMotion.magnitude > 0.3f) {
42  transform.forward = Vector3.Lerp(transform.forward, playerRig.AvgMotion, 0.05f);
43  }
44  else
45  {
46  transform.forward = Vector3.Lerp(transform.forward, playerRig.XZPlaneFacingDirection, 0.05f);
47  }
48 
49  if(Vector3.Distance(lastPos, playerRig.FeetInWorldSpace) > 0.1f) {
50  lastPos = Vector3.Lerp(lastPos, playerRig.FeetInWorldSpace, 0.1f);
51  }
52 
53  transform.position = lastPos;
54  }
Vector3 AvgMotion
Average motion of the players feet over the last 0.5s.
string speedAnimationParameter
Animation parameter that corresponds to the speed the player is moving at.
Vector3 FeetInWorldSpace
Position on the gorund directly underneath the camera. (World space)
AVR_PlayerRig playerRig
The current AVR_PlayerRig instance in the scene