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 993 forks source link

DestinationPoint GetRotation using localEulerAngles #1775

Closed UFNaviGator closed 5 years ago

UFNaviGator commented 6 years ago

NOTE: Any issue that does not follow the below template will be immediately closed and not re-opened until the template structure is adhered to.

Precheck

Environment

Steps to reproduce

Create a VRTK_DestinationPoint and set SnapToRotation to "Rotate with no headset offset". Attach it to another game object. Rotate the parent object off of 0 (say 45 or 90). Teleport to the destination point.

Expected behavior

Expected behavior is that your playspace would rotate to align with the rotation of the destination point within world space.

Current behavior

Playspace rotates in world space to the angle of the destination point in local space.

Additional info:

I am working on a "room space teleportation zone". I create a zone in our scene that resizes to match the play area. Within that zone I have a teleportation point that will move and rotate relative to your location and orientation within the real world playspace. The intention is that the point you are jumping to and the direction it is facing indicate where you will be when you get there. The problem I ran into is in attaching the teleportation point to another game object, if I rotate the parent object, your orientation is incorrect when you arrive.

I discovered that in VRTK_DestinationPoint.cs on line 456 if I change destinationLocation.localEulerAngles.y to destinationLocation.eulerAngles.y it fixes my problem. This may not be a bug and you may have intended it to work this way. If not I may be breaking something else by making this change. Exact proposed change: return Quaternion.Euler(0f, destinationLocation.localEulerAngles.y + offset, 0f); to return Quaternion.Euler(0f, destinationLocation.eulerAngles.y + offset, 0f);

thestonefox commented 6 years ago

Try version 3.3.0 from github master it should have fixed this issue.

UFNaviGator commented 6 years ago

It looks like the piece of code in question is unchanged in the release/3.3.0-alpha branch. I went ahead and downloaded the branch and tested with the same results.

Testing with "ValidDestinationPointFour [Rotation No Offset]" Destination Point set to rotate 72.4 degrees on Y. Teleporting to it sets my rig rotation to 72.4 degrees on Y. Create an empty game object rotated 72.4 degrees on Y and attach the DestinationPoint to it. The attachment results in destination point facing the same direction, but the local Y rotation is 0. Teleporting to DestinationPoint rotates my rig toward 0 degrees Y instead of the 72.4 degrees the destination point was indicating.

thestonefox commented 5 years ago

Closing this as it's related to an older version of VRTK (v3.3) the master branch is now on VRTK v4. Feel free to request to reopen if the issue is still present.