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 rhaak17 · Jul 19, 2017 at 08:34 PM · unity 5vrrotation axisperpendicular

Rotate an object in unity with vive controller around a fixed axis

Hey,

I'm quite new to Unity and currently trying to figure out how i can rotate an object around a fixed axis using only one of the vive controllers.

I think in theory I know what to do, but i'm not sure how to realise it or if it is even possible.

How it should work in Game: 1) Start the "rotating-action" for the object by pressing and holding trigger button. 2)Move the controller -> the object rotates relative to controller movement until triggerbutton is released

So what I think i have to do is the following:

1)After a certain time the triggerbutton is pressed, get the vector between the point where I pressed down the triggerbutton and the point where the controller position is now. 2)Calculate the orthogonal/perpendicular to this Vector. 3)Put the orthogonal/perpendicular in the center of the object and rotate the object around it, for some degrees depending on the controllermovement, doesn't matter at the moment. 4)Fix the rotation of the object to this rotation axis and continue rotating it, if triggerbutton is still pressed and the controller is moved.

I know it's maybe hard to understand, so i made some pictures. (The shown controller-movement shall be an up-movement.) In the first picture, you simply could rotate the object around its local x-axis. Picture 1 But in the second picture you could'nt, because the coordinate system is "twisted". And I'm wondering if my solution could work in this case? Picture 2

So, my question is, if my imagination of how it could work is even possible? For example the orthogonal/perpendicular for the "controller-movement-vector" is not unique, is it?

Would be happy about any type of advise, I've trouble with this problem for a long time now ..

Thank you in advance!

rotation1.png (426.2 kB)
rotation2.png (381.2 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by solidearthvr · Aug 07, 2017 at 06:01 AM

@rhaak17

I'm not sure I completely understand the main thrust of your question.

Are you trying to, for example, have the world space x rotation of the controller cause the object to rotate around it's local x rotation?

If this is the case I think Transform.localEulerAngles will help.

You can also use hinge joints to constrain object rotation to a certain local axis.

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 rhaak17 · Aug 10, 2017 at 09:16 AM 0
Share

I think I already got a solution which works for me.

I wanted to rotate the object around it's local x axis when moving the vive controller in world's y direction and rotate it around its y axis when moving the vive controller in object's x direction.

But I didn't know what do to when the coordinate system of the object is not in it's 'initial state', for example when it was already rotated somehow. I didn't know around which axis I should rotate if the user moves the controller along the world's y axis.

$$anonymous$$y solution so far is to take the axis of the main camera(vr headset) to rotate around them. $$anonymous$$g. user moves the vive controller in world's y direction -> object rotates around camera's x-axis. Or user moves the vive controller in camera's x direction -> rotate object around world's y coordinate.

I hope it's clear know what my question was and how my solution looks like, I can imagine it's not easy to understand..

Either way, I got a solution that works for me, so I need no help anymore. Nevertheless, thank you for your answer solidearthvr ! :)

avatar image solidearthvr rhaak17 · Aug 10, 2017 at 03:26 PM 1
Share

Glad you got it working!

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

154 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

Related Questions

Camera is dislocated after build. 0 Answers

Run Tilt Brush Open Source code on Oculus Rift S 1 Answer

Unity Abstract Parent Class not in Build, but in Editor 0 Answers

Simulating input for Unity Gear VR application. 1 Answer

VR Splash Screen on Unity Personal 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