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

Object ignores collider when pushed towards

Discussion in 'Physics' started by Andwari, Mar 1, 2017.

  1. Andwari

    Andwari

    Joined:
    Mar 1, 2017
    Posts:
    3
    Hello,

    I'm Andwari and am quite new to unity. I have made a simple tank game.
    The bottom of the tank is the parent. On top of it I have placed a child box, which is my tank turret with a barrel.
    I control the bottom movement and the top rotation with left and right controller sticks.
    I have box colliders for the bottom and the top and a capsule collider for the barrel.

    When im close to the wall and rotate the top and the barrel collides with the wall the whole tank is moved away from the wall. Everything works fine so far.
    But when I position between two walls the barrel still pushes away the tank from the wall it collides with but therefore the other parts of the tank seem to ignore the second wall and vanish into it.

    I have a Rigidbody for the Bottom. The top is a child of the bottom and the barrel is a child of the top.
    I have searched the internet for answers but could not find what I am looking for or maybe am missing the correct 'name' of my problem. I also tried different collision detections.


    Does anyone know how to solve this?
    Best regards,
    Andwari
     
  2. SarfaraazAlladin

    SarfaraazAlladin

    Joined:
    Dec 20, 2013
    Posts:
    280
    Sounds like a unique problem to me, and I can't say that I have an answer for you...

    My only suggestion would be to limit the rotation of the top of your tank when it hits a wall. That way it won't push your tank around and you can avoid the problem.
     
  3. Andwari

    Andwari

    Joined:
    Mar 1, 2017
    Posts:
    3
    I made a short clip demonstrating my problem.



    Thank you, i consider your suggestion if there is no other way. But since I think it would be fun to move in some situations with the barrel colliding and therefor rotating the whole tank i hope i will find out what causes this.