Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

conflicting colliders on an object in the Pickup layer

Discussion in 'Physics' started by bhoffman67, Sep 19, 2022.

  1. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    Unity 2019.4.31f1, using VRChat_pickup script.

    Essentially, the script allows a player to equip/pickup an object on the Pickup layer as long as it's not marked as Static, has a collider attached to the object, and a Rigidbody component.

    The problem arises when the object to be picked up is being effected by an unseen/unknown collider... somewhere. Is there a way to determine what colliders are acting on any given object?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    That's a rendering thing, nothing to do with physics.

    Yeah, stick a OnCollisionEnter(2D) and/or OnTriggerEnter(2D) and dump it to the console or attached the debugger and place a breakpoint.
     
  3. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    Okay, great... thanks for the reply. I apologize for asking, but can you be more robust in how to go about that?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    Sorry, what do you mean by robust? You want links? If so, to what specifically?

    Unity Debugging
     
  5. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    stick a OnCollisionEnter(2D) on what, where, how. is that a script, a component, is there an event handler I need to find.... etc?

    I guess an example would be perfect.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    Yes what I said assumes you know how to use physics for this basic stuff. I don't have your project, I can't write you specific code really. It should be known this is a script, these are script callbacks. :)

    I mean, it should be clear that if you have two things colliding and you only know about one of them then put a script on that one, add in the callbacks I stated to it and use Debug.Log or a breakpoint. You can then see what collider you hit because these callbacks tell you what was hit.
     
  7. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    Add these to the "object to be picked up" whatever that is:

    Code (CSharp):
    1. void OnCollisionEnter(Collision col)
    2. {
    3.    Debug.Log(col.gameObject);
    4. }
    5.  
    6. void OnTriggerEnter(Collider col)
    7. {
    8.    Debug.Log(col.gameObject);
    9. }
     
  8. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    I keep searching and finding nothing out of place. I did create a cube as a pickupable, waaaay off the corner of my world which works perfectly. I grabbed it and walking right up next to the blowdryer that is causing me all this grief and set the cube down next to it. The cube has no problems.
     
  9. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    Be aware that this only means something to you. You're making assumptions that others can see what you mean. We don't know what "the blowdryer" is etc.

    It's the presumption that you're using 3D physics, you didn't explicitly state but you mentioned some "VRChat_pickup" (no idea what that is) which would suggest 3D.

    Really, don't make the assumption that anyone knows what you're doing and therefore knows about your project. If you need help, you need to show something otherwise it's just guessing on our part. We also have no idea of your experience with Unity which makes it harder to give you information.

    The above scripts would tell you what you're colliding with. If you don't understand how physics callbacks work which are the first thing that most physics tutorials show then you need to go follow some of them. I'll be honest, I don't understand how you can be doing VR work without understand the basic of physics so maybe it's about time to follow some of those tutorials.

    If you are indeed using 3D physics then have you looked at the Physics Debugger? This can be used to visual colliders etc.
     
  10. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    Yes, I'm guilty of assumption making. Helpful folks like seem like they all really grok something I've only been engrossed in for a few months and am sadly just wingin things here by watching countless youtube vids and making endless mistakes.

    As a picture is worth 1000 words, I've included links below to 2 that I hope help shed light on my issue here.
    https://drive.google.com/file/d/1nS2Q59v8jKhTnRSTAv0kqnIUas43onNg/view?usp=sharing
    https://drive.google.com/file/d/1gJeYJBUxBYq55_K1okfA-ttMrm5pgJ97/view?usp=sharing
     
  11. bhoffman67

    bhoffman67

    Joined:
    May 14, 2022
    Posts:
    18
    "VRC Pickup" is a script, written by VRChat which i've never looked at but does indeed do it's job as I've seen with the simple Probuilder cube object. I'm familiar enough with the Physics debugger to say I've used it.
     
  12. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,563
    Selecting the physics debugger allows you to visualise all colliders. Your problem is that you're (apparently) hitting an "unknown" collider so this will let you see what's there. Showing me static images without explanation won't help shed any light and I'm still not sure what else I can do for you. Doing what I said above would take a minute or so to do.

    I think you're waiting for me to say something magically to help you, unfortunately I don't have anything to add, sorry. :(