Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 JamesClow · Jan 28, 2020 at 11:28 PM · collidervrscalelocomotionroom

Is using a rigidbody/collider based movement script with an XR Rig that has a non-relative XR camera possible?

What do I have?

I have a typical XR Rig parent gameObject with a camera as a child object. The XR Rig parent gameObject has a Rigidbody, Collider and movement script to allow locomotion via joystick and a camera set as a Generic XR Device and to NOT use relative transform.

What do I see?

When I click on play, the camera starts in a different x,z position to the XR Rig. This becomes apparent when comparing the visible location of the XR Rig collider despite both Rig and Camera being in the same place in the editor before hitting play.

What do I want to achieve?

I want to be able to use room scale so that the player can physically move to move the player as well as using a joystick for main locomotion.

The problem?

To use a joystick for locomotion requires the camera child object to move with the parent rig gameObject, which has the movement controller script attached to it. That works fine, but in order to get the collider that is attached to the XR Rig parent to be in the right place for collision, i.e where the camera is, you would need to move the Rig to be in the same place as the camera so that when you physically move the collider attached to the parent rig it would be in the right place.

What have I tried?

On the main rig, I have tried

 public Transform camera;
 
 void Update()
     {
  gameObject.transform.position = new Vector3(camera.position.x, camera.position.y, camera.position.z);
 }

This causes the player to 'fly off' in a direction, presumably because of the camera being a child object of the rig I'm trying to move that has the camera in it?

Just out of interest, to see what would happen, I tried to set the camera position to being the position of the rig using the script above on the camera, using the XR Rig parent gameobject , and the camera position was still away from the rig, i.e nothing changed.

Would the only option be something like trying to set the parent XR Rig gameObjects collider offset dynamically to keep it where the camera transform is? If that is even possible.

Any ideas would be welcome.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by rh_galaxy · Feb 08, 2020 at 05:43 PM

Just some thoughts. The problem is that the camera WILL move when the user move the head, having a collider will not change that. So having room scale movement and not sitting/standing still movement (which will also be a problem if you move too far from a initial centered position) together with joystick movement is conflicting with that. A solution that some games uses is to detect collisions and push the camera back so you don't end up inside objects.

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 Piedpiperz80 · Apr 22, 2021 at 02:21 AM

I'm having this same issue, I can't offer any help at the moment but I am working on it and will let you know if I come up with anything.

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

188 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

Related Questions

how to scale object to fit inside a room 1 Answer

Detecting and setting active a child object using VRTK 0 Answers

Scaling the Mesh Collider 4 Answers

How to get expanding object collide when it touches others? 1 Answer

Scale collider independent of gameObject. 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