ExtendRealityLtd / VRTK

An example of how to use the Tilia packages to create great content with VRTK v4.
https://www.vrtk.io/
MIT License
3.69k stars 1k forks source link

Unwanted positionchange through VRTK_RotateObjectControlAction #1693

Closed RunenGamer closed 6 years ago

RunenGamer commented 6 years ago

Environment

Steps to reproduce

  1. Pull latest from feature branch 3.3.0-alpha
  2. Open Example scene 017_CameraRig_TouchpadWalking
  3. Enable SteamVR SDK (download, enable, populate)
  4. Select [VRTK_Scripts]>PlayArea>LeftController>TouchpadControlOptions
  5. Disable GameObject "XAxis = Slide - YAxis = Slide"
  6. Enable "XAxis = SnapRotate - YAxis = Slide" (or another rotate one)
  7. Start scene, use touchpad to rotate and observe global position of [VRTK_SDKManager]>SDKSetups>SteamVR>[CameraRig]>Camera (eye)

Expected behavior

No matter where the real player stand inside of the PlayArea, a rotation should only rotate the player without changing player's global position.

Current behavior

Depending on where the real player stand inside of the PlayArea, the rotation not only rotates the player (Camera (eye)) but also changes player's global position (because [VRTK_SDKManager]>SDKSetups>SteamVR>[CameraRig] gets rotated).

I would like to fix that by reposition [VRTK_SDKManager]>SDKSetups>SteamVR>[CameraRig] accordingly. Therefore I suggest to push to the master branch. If you do not consider this behaviour as a bug, I suggest to implement a feature (public flag on these scripts to enable repositioning) and target the release/3.3.0-alpha branch.

LuckyJosun commented 6 years ago

I've noticed this in the current release. Functionally, it seems as though the playspace's centre point is being used as the pivot for rotation. Ideally, the pivot point should be the centre of the headset.

So currently, if the headset is in one corner of the playspace while snap rotate is used, the players position in the gameworld can be dramatically changed instantly -- in my case, this causes players to move completely through virtual walls when snap rotating near them.

I'm using an Oculus CV1 w/ Touch Controllers, the current SteamVR Unity Plugin (1.2.3 aka 54), the current release of VRTK (3.2.0), and Unity 2017.3.0f3 Personal. Windows 10.

bddckr commented 6 years ago

@LuckyJosun Use VRTK 3.3.0. Unity 2017.X isn't even supported by < 3.3.0.

LuckyJosun commented 6 years ago

@bddckr thanks for your reply, I didn't realise. I was using the version from the asset store (listed as 3.2.1). The asset page says it is compatible with "5.5.3 or higher", but I presume that text is unchangeable. I've grabbed the current state of 3.3.0-alpha now, and will work with that going forwards, updating as necessary.

I've also checked if this issue exists in 3.3.0-alpha on my machine, it does. I've experimented with it a little more, and it looks as though the rotation pivot isn't the centre of the playspace - it's the starting position of the headset.

To reproduce, follow @RunenGamer 's steps above, but replace step 7 with: Physically place your headset in one corner of your playspace, start scene, physically carry your headset to the opposite corner of your playspace, then use the right touchpad/stick to rotate the player observing the global position of [VRTK_SDKManager]>SDKSetups>SteamVR>[CameraRig]>Camera (eye)

On my machine, this drastically changes the position of the player with each rotation.

Edit: It looks like the scene view isn't showing the camera move, but it is very noticeable inside the headset. I'd recommend setting up slide on one controller, and snap turn on another. Create a small cage from scaled cubes with no colliders, stand inside that and rotate from various areas in your physical playspace (with the headset on). You'll find the rotation moves you outside of the cage consistently, from certain spots in your play area.

RunenGamer commented 6 years ago

Edit: It looks like the scene view isn't showing the camera move, but it is very noticeable inside the headset. If you look at the headset's transform you can see the position change.

@thestonefox Do you want to confirm the bug or does these two observations confince you, so that I can make a PR with the fix?

thestonefox commented 6 years ago

feel free to make a pr

RunenGamer commented 6 years ago

@thestonefox Thank you. I will work on it. I will make a PR by sunday or earlier.

JWNJWN commented 6 years ago

This is fixed in current master. @thestonefox