Search Unity

Drawer setup

Discussion in 'Physics' started by VREasy, Sep 10, 2018.

  1. VREasy

    VREasy

    Joined:
    Dec 8, 2016
    Posts:
    10
    Hi

    I am trying to setup a basic drawer for a cabinet where I want to put some objects with physics. When I slide to open I want to move the objects with the drawer.



    I have tried so many things and the one moves correct when adding 5 coll boxes

    On the spheres I added a rigid body with the default settings, using Unity 2018.1.3.
    On both situations I also added a rigid body with the Use Gravity deactivated. The only difference is the mesh collider, maybe it is too thin? Or my approach is completely wrong:)

    Any help would help because it should be very simple to setup, right?

    Thanks
     
  2. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    I am a little confused since you said you got one to work correctly. So what else do you need then?
    Anytime you are working with collisions it is helpful to reference this page:

    https://docs.unity3d.com/Manual/CollidersOverview.html
    The matrix at the bottom is extremely helpful.

    I think one of your issues is that you need at least one rigibody collider to interact with a non rigidbody collider.
    In your case since they are not static I would make them all rigidbody colliders including the balls. You can leave gravity on as well as long as you have a bottom collider for the floor.

    You will probably have to play with the mass of the objects to get them to behave the way you want to.
     
  3. VREasy

    VREasy

    Joined:
    Dec 8, 2016
    Posts:
    10
    Sorry for the late reply. Thank you very much for the info and the correct working ones was when I added 4 collision boxes to 1 single object. This is a correct way to setup?
    I am going to do what you have recommended.

    Thanks
     
  4. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    I don't see any reason why your method wouldn't work as long as your colliders are set properly and according to the collision matrix I attached on my last post. Again, it may not work perfectly and you may have to adjust some settings to get the proper response. This isn't to say this is the best method available either but it is one method and it's a method I would use. Also, don't forget your physics materials either. This will help determine how the collisions interact.