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 /
  • Help Room /
avatar image
1
Question by Kerbiriou · Jun 28, 2016 at 04:00 PM · rotationpositionvrcamera movementtracking

[VR][VIVE] allow rotation only ?

Hi, I'm making a VR game with VIVE, and I want the view to be locked at a certain position, but still allowed to look around. In other words, I want to simulate Occulus behaviour with a VIVE setup :p

At first sight I thought it would be piece of cake, but I'm fairly stuck in my project, I tried a lot to modify the SteamVR scripts, to apply "(local)position = Vector3.zero every Updates", nothing works...

I did not found this issue on unity's forum so If you have any ideas, let me know, thanks a lot :)

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

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Kerbiriou · Jun 30, 2016 at 11:27 AM

I finally figured out a solution: Moving the camera rig to offset the head position, but it only works if you use localPosition, there is my script: (put it directly on [CameraRig])

 public class CameraRigStabilizer : MonoBehaviour {
 
     private Vector3 InitialPos;
     private Vector3 hmdPos;
     public GameObject HMD;
     public Transform CameraPos;
     
     void Start ()
     {
          InitialPos = transform.position;
     }
     
     // Update is called once per frame
     void LateUpdate ()
     {
         //hmdPos = HMD.transform.position;                         Can't work in world position
         //transform.position = InitialPos - hmdPos;                for some reason
         hmdPos = HMD.transform.localPosition;
         transform.position = CameraPos.position - hmdPos;
     }
     
  }

HMD = camera (head) , CameraPos = Where you want your head to be

hope that will help someone :)

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
3

Answer by FalconCK · Jul 05, 2018 at 03:41 PM

UnityEngine.XR.InputTracking.disablePositionalTracking = true;

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 LukeSkypewalker · Nov 06, 2016 at 06:55 PM

Dear @Kerbiriou ,

I have a similar task, (but I have to discard Z_rotation) and your script looks like a great place to start. Anyway, I can't reproduce your solution even without any changes. Can you share a demo scene (work37 gmail com) or explain more verbosely how to use your scipt?

I've attached it to [CameraRig], HMD = camera (head) , CameraPos = I've made an empty GameObject in the Root of the hierarchy. Maybe something here is wrong

Thanks!

Comment
Add comment · Show 1 · 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 Kerbiriou · Nov 12, 2016 at 11:23 PM 1
Share

Hi, Indeed, your task seems pretty similar, but I have no H$$anonymous$$D right now to make tests, so I will only tell you what may be a solution. I observed weird behaviours between the Vive and Unity space. However, I think you only have to reset your hmd (head) z-rotation every frame. In other words, you may save your current z-rotation in a variable, let's say zRot. Then you write into a LateUpdate (to make sure everything happened) :

hmd.rotation.z=zRot;

I even think you can modify my script by replacing "position" by "rotation.z"

Also, you may have issues using the world rotation, if yes, try using the local rotations, a bit like I did :)

That's it, I may have forgotten some "transform" or something, I did not do any unity programs for a while, and I forgot a lot about rotations in Unity, sorry about that.

Hope it was usefull though :)

avatar image
0

Answer by pnewyork · Feb 22, 2017 at 04:57 AM

Dear @Kerbiriou ,

I tried to use your script for allowing rotation only. (I put this script on [CameraRig], and I attached Camera(head) object as HMD, empty gameObjcect as CamerPos)

But, camera still move around.

Do you have any idea to solve this problem?

Thanks!

I'm working on Unity 5.5.

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

84 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

Related Questions

How to make character movement track users head rotation 0 Answers

How can I make an object transform to given position and rotation 2 Answers

Automatically flip a player game object upright on z axis? 1 Answer

Can't edit an object's rotation manually? 1 Answer

Making The Z rotation always on 0 plz help 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