• 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 Rusherz · Mar 23, 2019 at 06:14 PM · collisionvroculusoculusriftoculus rift

OVR Grabbable causes object to ignore OnCollisionEnter/Exit

I have a very simple script attached to a cube the only thing in the script is:

 void OnCollisionEnter(Collision collision) {
         Debug.Log("We hit something");
 }

When i start the game the Debug message gets put in the console. But when I grab the cube and move it away then put it through the cube it was on in the first place the message doesnt get printed. If I then let go of the cube and drop it either on the first one or onto the plane the message is then printed again.

I've tried all 3 modes for collision detection on the rigidbody and haven't been able to find anything that relates to this very well on google.

I'm running Unity 2018.2.21f1 (I did have 2018.3 but I had to downgrade because something wasn't working right I think I couldn't grab anything at all and its a known issue or something like that I cant remember)

Comment
Add comment · Show 2
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 dtrevillyan · Mar 24, 2019 at 12:17 AM 0
Share

I tried this on one of my projects using OVRGrabbable and I did receive the message in the console when a collision occurred, even if I was holding the grabbable object. I don't believe that it is OVRGrabbable suppressing the callback but I don't know why that would be occurring. It could have something to do with the some or all of the rigidbodies kinematic setting as true.

avatar image Rusherz · Mar 24, 2019 at 12:31 AM 0
Share

I just found out that, that is what is causing my issue is the object being set to $$anonymous$$inematic = true

If I remove that from the OVRGrabbable script the collisions work normally. But does yours do this (Set everything to kinematic = true) and you still get the collision properly? @dtrevillyan

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by dtrevillyan · Mar 24, 2019 at 01:20 PM

@Rusherz, actually I didn't try it. I did see in the scripting API for the OnCollisionEnter callback that at least one rigidbody needs to be nonkinematic. That is why I suggested checking the setting. Glad to hear it is working now.

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 DDorukA · Apr 06, 2019 at 12:58 AM

I am using OnTriggerEnter with tags instead of OnCollisionEnter and it works fine for the most cases. Here is an example that is working for my project.

 void OnTriggerEnter(Collider other)
 {
     int randomClipNumber = Random.Range(0, SwordCollisionAudioClips.Count);
     CollisionAudioSource1.clip = SwordCollisionAudioClips[randomClipNumber];

     if (other.gameObject.CompareTag("Sword"))
     {
         CollisionAudioSource1.Stop();
         CollisionAudioSource1.Play();

         Play Vibration
         VibrateRightController();

     }
     if (other.gameObject.CompareTag("Player"))
     {
         other.gameObject.GetComponent<PlayerBeh>().TakeDamage(weapondmg);

         Play Vibration
         VibrateRightController();
     }

 }
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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

192 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 avatar image avatar image avatar image avatar image

Related Questions

How to disable automatic recentering when using OVRCameraRig 0 Answers

how to make Oculus Touch door opening 0 Answers

How can I let a VR player walk up walls using Oculus' OVR Camera rig? 0 Answers

How do you detect the Oculus remote without using OVRInput? 0 Answers

Is it possible to override the "Cannot set field of view on camera with name 'screenCamera' while VR is enabled." limitation? 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