Search Unity

How to make an object(cylinder) always at the center of an object(Terrain)?

Discussion in 'Physics' started by spiderman2015, Aug 26, 2015.

  1. spiderman2015

    spiderman2015

    Joined:
    Jun 16, 2015
    Posts:
    13
    I have a cylinder that have rigidbody. So what I want to do is make the cylinder roll down and make its position in the middle of the slides(boxes), and rotate itself depending on where the slides are leading to until it reach the end. Please help me.
    a.png



    b.png
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    It should do it by itself, you need to put a custom mesh collider to it, and attaching a physics material with high friction, but it should do, if you don't want to make a custom collider, attachibg a sphere collider, and freezing z or x rotation should also work
     
  3. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Oh, I see, you could solve this with invisible walls, or positiom freezing.
     
    spiderman2015 likes this.
  4. spiderman2015

    spiderman2015

    Joined:
    Jun 16, 2015
    Posts:
    13
    ohhh thank you so much