Sliding an object on x axis in VR

You can:

  1. For a sliding door: when triggered, you’ll need to match the controller’s world location to the door’s relative location, then you need to shoot a line from the translated position of the controller to the door to tell it to move parallel in X.

Basically:

  • Point A is ( 0, 0, 0 ) relative to your door.
  • Point B is the VR controller relative to the door.
  • You need to find line c.
  • Draw line a or draw line b to get point C (already a given if you found point B)
  • And finally set door’s X to point C
    image

You can limit the door’s movement by clamping the C point.

  1. Or…

You’ve found line b and set point C.

1 Like