Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by rocketstrong1 · Aug 06, 2018 at 04:50 AM · vrquaternionvectors

Getting the rotation around the vector3.up.

 Quaternion target = new Quaternion(transform.rotation.x, (LeftController.rotation.y + RightController.rotation.y)/2,transform.rotation.z, (LeftController.rotation.w + RightController.rotation.w)/2);
 transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * 1.5f);

This is my method for guessing body rotation in VR it kind of works but has weird rotation at specific angles. I use the W and Y components of a Quaternion.

I am trying to find the "universal" vertical axis of the controller regardless of its other local axis's. Now i'm aware that not everyone will understand what I mean when I say this, so I have drawn up a quick representation for what I mean when I say "universal" axis and local axis.

Diagram

untitled.png (34.7 kB)
Comment
Add comment · Show 3
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 bobisgod234 · Aug 06, 2018 at 05:17 AM 0
Share

Could you perhaps flatten and normalize local Z/X axis, then use Vector3.SignedAngle?

Something like

 Vector3 flatForward = target.forward;
 flatForward.y = 0;
 float angle = Vector3.SignedAngle(Vector3.forward, flatForward.normalized(), Vector3.up);

Should get you the angle of the object around the global Y axis, while allowing you to tilt the object around X and Z

avatar image rocketstrong1 bobisgod234 · Aug 06, 2018 at 06:52 AM 0
Share

Tried it when i point the controller up and rotate around what would then be the x it returns much greater angles.

avatar image hexagonius · Aug 07, 2018 at 04:17 AM 0
Share

to ne it looks as if with vertical axis you mean Vector3.up in world space. if you're interested in that axis in local space just InverseTransformDirection it into the objects transform.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rocketstrong1 · Aug 07, 2018 at 04:46 AM

I believe I have solved my problem with this helpful link Yaw from quaternion

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

118 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

Related Questions

Amplifying HMD rotation in VR 2 Answers

Rotate object based on rotation of SteamVR Controller? 2 Answers

Set a rotation relative to position between two objects. 0 Answers

How to compare two rotations from children objects 1 Answer

Change rotation of an object based on an HTC Vive Controller 1 Answer


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