VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Vector3 AVR.Avatar.AVR_PoseNaturalizationFilter.naturalize_point ( Vector3  wpos)
inline

Definition at line 57 of file AVR_PoseNaturalizationFilter.cs.

57  {
58  try {
59  // Transform worldspace -> local space (relative to the PlayerRigs camera)
60  Vector3 cpos = AVR.Core.AVR_PlayerRig.Instance.MainCamera.transform.InverseTransformPoint(wpos);
61 
62  // Get a weighted average of reference points that are closest to this location
63  Vector3 closest = get_weighted_average_reference(cpos);
64 
65  // Smooth over time
66  outpos = Vector3.Lerp(outpos, closest, Time.deltaTime * smoothing_speed);
67 
68  // Interpolate by given value
69  return AVR.Core.AVR_PlayerRig.Instance.MainCamera.transform.TransformPoint(Vector3.Lerp(wpos, outpos, interp));
70  }
71  catch(System.Exception) {
72  AVR_DevConsole.cerror("PoseNaturalizationFilter failed! Is AVR_PlayerRig.Instance set correctly?", "AVR_PoseNaturalizationFilter");
73  return wpos;
74  }
75  }
float interp
interp = 0 means we dont naturalize at all, interp = 0.5 means the output is 50% input and 50% natura...
float smoothing_speed
how much to smooth motion by