Search Unity

Sliding Cube is rotating at inclined plane

Discussion in 'Getting Started' started by Christoph_CH, Oct 12, 2015.

  1. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Hi

    I add two cubes in an angle as my sliding plane (with physics material "ZeroFriction" from SampleAssets)
    The yellow cube (rigidbody) is falling down, turns regarding angle of plane and then slide down.
    So far so good...

    When the yellow cube reaches the transition between both planes it turns about 90 degrees and go on sliding.
    Why is this happen, and how can I prevent this ??

    I could lower the second plane, but things get very complicate, when I have more then 2 planes in a row...
    When I freeze rotation of cube , it doesn't align when it fall down...
    Any other idea ??

    Thanks

     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Use a single cube for your plane... or if you need them to be different colors, then just take the BoxCollider off of one of them, and extend the BoxCollider of the other to cover them both. Physics only cares about the colliders; it doesn't care what things look like!
     
    jhocking likes this.
  3. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Good idea, but I need collider of every plane, because they will have different functions...
    Maybe I need a box collider with round edges (-;
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I think you need to separate the function of being a solid body in the physics world, from whatever other functions you have in mind.

    For those other functions, you can add trigger colliders (i.e. colliders with isTrigger set to true). Have as many of these as you like, on one object or different objects.

    For the physics, use as few true colliders as you can. And if you want it to behave like there's no gap between those boards, then you should model it as a single collider.
     
  5. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    I think you are right; using different colliders will solve my problem..
    I can change actual colliders to triggers and have to calulate one extra collider for every straight line...

    Thanks
     
    JoeStrout likes this.