Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
4 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ninetyfive · Jan 16, 2021 at 05:45 AM · rotationpositionvrcontrolleroffset

XR Controller (XR Ray Interactor) rotation and position offset?

I cant seem to find a way to offset the native rotation of my XR controller. Its not a big deal for the direct Interactor since i can rotate the controller Model and move the Transform. However for the XR Ray Interactor, no matter how my Hand model is rotated, the ray always shoots out from a (atleast for me with the Index controller) very uncomfortable angle.

Ive added an illustration to explain what i mean:

alt text

The Ray interactor always hast to be attached to the same GameObject as the XR Controller so i cant just add the Interactor as a Child to the GameObject.

screenshot-2021-01-14-192756.jpg (285.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by ChrisWarner103 · Mar 12, 2021 at 12:58 AM

I'm not too sure if you managed to solve this at all or anything. But I managed to find out a way to change the position of where the Raycast starts. I went through the XRRayInteractor script and found a transform variable that was used called "startTransform" which is then referenced to the Original Attach Transform. Which is the instanced empty GameObject called "[Controller] Original Attach" by moving this object it changes where the Raycast originates from. (Extra note, the OriginalAttachTransform also copies the AttachTransform reference after interacting with an object. So by setting that, it'll set the Original Attach Transform by default)

Which is the object that I have selected in the screenshot below: alt text

I hope this helps you out and anyone else that finds this thread!


unity-yobhrichbi.png (8.5 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by andykibz · Nov 07, 2021 at 05:15 PM

If anyone still needs a solution for this, create an empty with your desire transform(position and rotation, then use it in the Attach Transform field of the XR Ray Interactor.alt text .


untitled.png (26.6 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by gagarin-interactive · Jan 20, 2021 at 02:18 AM

Did you figure this out? I am also trying to offset the ray but cant figure out how - without using a hackish workaround. At runtime an gameobject called "original attach" is added under the controller. This is the object used to offset the ray.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ninetyfive · Jan 20, 2021 at 12:06 PM 0
Share

Not yet unfortunately. But your hint with the original Attach sounds promising! Thank you for that! Ill have a look into it this Evening. $$anonymous$$aybe there is away to offset it on Awake or Start to match the transform of a reference Object for excample :)

avatar image GebhardtXR ninetyfive · Jun 25, 2021 at 07:34 AM 0
Share

You can create an empty GO as a child of the controller as a custom AttachTransform with desired transform and assign it in your XRRayInteractor's Attach Transform slot. This overrides the automatic creation of an AttachTransform and sets the orientation and origin of the ray as you wish.

avatar image
0

Answer by ArtIsEverything · Apr 14, 2021 at 10:17 PM

okay so there is a very dumb way of fixing this, and I fully would appreciate if someone found a better way. But the way I did it was to create a script on an empty object that on Start() does a GameObject.Find on the Attach and Original Attach objects, uses GetComponent-Transform()-.rotation to get the rotation and sets it manually. It ain't pretty, but it works! Also you should remember for this that the Euler function has a weird order of z,x,y so make sure if you take a Vector3 input to switch the numbers around before applying them as the rotation. It's stupid but it works!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Muskie · Nov 12, 2021 at 07:08 AM

I have discovered a solution to this issue:


  1. Remove the XR Ray interactor, Line Renderer, and XR Interactor Line Visual components from the controller object.


  2. Create an empty gameobject as a child of the controller, and name it appropriately (RayInteractorOrigin or whatever).


  3. Add the XR Ray Interactor, Line Renderer, and XR Interactor Line Visual components to the child. DO NOT add an XR Controller component. This will be handled by the XR controller object in the parent object.


  4. The interactor Raycasts will now originate from the new object. No need to use Attach Transforms.


Quick note: The Raycast will point towards vector3.forward (the X (Blue) Axis) of the RayInteractorOrigin Object. You'll need to rotate the object accordingly so it points the way you want.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

221 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to write a script to disable position and rotation tracking for VR 0 Answers

Use SteamVR and Vive controller or tracker ONLY for position tracking, no headset 1 Answer

How do I determine the rotation of the XR unity controller if it is held upright or held facing down 2 Answers

HTC Vive Controller Twist - Extracting Angular Velocity On The Correct Axis 0 Answers

how to ignore transform.position.y 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges