VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Motion.AVR_LocomotionProvider.LateUpdate ( )
inlineprivate

Definition at line 101 of file AVR_LocomotionProvider.cs.

102  {
103 #if AVR_NET
104  if (IsOnline)
105  {
106  sync();
107  if (!IsOwner) return;
108  }
109 #endif
110 
112  Vector2 md = controller.inputManager.getEventStatus(moveDirection);
113  Vector3 dir = tF(md);
114 
115  switch(dirType) {
116  case DirectionType.RELATIVE_TO_CONTROLLER : {
117  dir = controller.transform.TransformDirection(dir);
118  break;
119  }
120  case DirectionType.RELATIVE_TO_RIG : {
121  dir = playerRig.transform.TransformDirection(dir);
122  break;
123  }
124  case DirectionType.RELATIVE_TO_HEADSET : {
125  dir = playerRig.MainCamera.transform.TransformDirection(dir);
126  break;
127  }
128  }
129 
130  movement = Vector3.Lerp(movement, dir * speed, acceleration_constant);
131 
132  if(disable_y_axis) movement.y = 0;
133 
134  if(ch) {
135  ch.Move(movement * Time.deltaTime);
136 
137  if(use_gravity) {
138  Vector3 gravity = Physics.gravity * Time.deltaTime;
139  ch.Move(gravity);
140  }
141  }
142  else {
143  AVR_DevConsole.cerror("The PlayerRig does not have a charactercontroller. LocomotionProvider requires a charactercontroller.", this);
144  }
145  }
146  }
AVR_ControllerInputManager inputManager
the AVR_ControllerInputManager assigned to this controller. Returns null if no inputmanager is assign...
AVR_ControllerInputManager.Vec2Event moveDirection
The event we retrieve our movement vector from.
float speed
Determines the base movement speed of the charactercontroller.
bool getEventStatus(BoolEvent type)
Returns the status of a given BoolEvent
bool use_gravity
Determines whether if gravity is applied to the charactercontroller.
float acceleration_constant
Determines the amount acceleration. 0 means no movement ever, 1 means instant acceleration.
bool disable_y_axis
Disables movement along the world-space y-axis. This exludes gravity, which will still be applied if ...
DirectionType dirType
What should determine the direction of movement? Example: "RELATIVE_TO_CONTROLLER" will move the Rig ...
AVR_ControllerInputManager.BoolEvent moveEvent
Movement is only performed when this event is true.
System.Func< Vector2, Vector3 > tF