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
0
Question by baroquedub · Jan 25, 2017 at 12:26 AM · vrfpsclippingsorting layers

Stop Gun clipping into objects in Google VR (Cardboard) FPS game

Trying to stop clipping of my FPS gun into walls, for a VR game I'm making.

Traditional fixes seem to use multiple cameras, but I can't use this method for a VR camera setup.

I tried using the super useful script at: https://forum.unity3d.com/threads/drawing-order-of-meshes-and-sprites.212006/#post-2899026 as well as other similar scripted ways, to set the SortingLayer layer and sortingOrder on the gun mesh but these don't seem to have any effect. Is this something special about the Gvr camera?

Are there any other workaround?

Many thanks

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
1
Best Answer

Answer by sutdisi · Feb 09, 2017 at 12:08 AM

Hi @baroquedub,

I had the same issue. I was able to get multiple camera solution working against clipping. This was my setup:

GvrMain ->Head ->Main Camera

I added a second camera under the head, then applied the solution using culling mask you mentioned. Also don't forget to increase the depth of this second camera so it'll draw on top of the main camera.

Comment
Add comment · Show 3 · 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 baroquedub · Feb 09, 2017 at 11:00 PM 0
Share

You're a star! That did it :)

Just to be clear to anyone else interested, I used this method for fixing the clipping: http://answers.unity3d.com/questions/41298/fps-gun-clippes-through-walls.html and placed the gun camera as a child of the main camera: Gvr$$anonymous$$ain ->Head ->$$anonymous$$ain Camera-> gunCamera (Works on Cardboard and GearVR)

[edit] weirdly this worked fine in the editor but was broken in my builds. As was originally suggested by @sutdisi the gunCamera does need to be a child of the Head. Unfortunately I've found that on Gear VR this makes the camera lag a bit (I guess because of the additional overdraw) so I've decided not to use it. Shame!

avatar image sutdisi baroquedub · Feb 10, 2017 at 12:26 AM 1
Share

Sorry, this didn't work for you. For anyone curious I used this on iOS and it worked fine.

avatar image baroquedub sutdisi · Feb 10, 2017 at 12:33 AM 0
Share

Don't get me wrong. It works. and I was very grateful for your answer. It's just that the performance hit on my game isn't making it worth my while implementing it. (I'm pretty sure it's related to the additional overdraw)

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

119 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

Related Questions

X ray shader 1 Answer

Why do objects clip through eachother in VR (XR)? (Oculus quest 2) 0 Answers

VR first person Collision Headset Wall Clipping,How to avoid wall clipping using HTC vive, and Arm Swinger as locomotion? 0 Answers

FPS Weapon Clipping 1 Answer

All of a sudden: Weird Camera Clipping in VR 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