Search Unity

Resolved [FIXED] Issues with the weight of BoxColliders

Discussion in 'Physics' started by AlexNikolay, Apr 14, 2023.

  1. AlexNikolay

    AlexNikolay

    Joined:
    Mar 1, 2022
    Posts:
    29
    Hello! Im having trouble with boxColliders.(SEE IMAGES BELOW) So, im making a car, which has a custom suspension that is working pretty well, the issues start when i add a box collider to a door so that the player doesnt go through the car door, obviously. So i added a script that opens that door and in the moment that the door opens, the car tilts at the door's direction and the suspension goes down so badly. I need to fix that, I was thinking about disabling somehow the weight of the box collider but i dont know if i can do that... So if someone could help me it will be nice, because im planning to add alot of colliders...

    BEFORE OPENING DOOR:
    Desktop Screenshot 2023.04.14 - 12.30.00.18.png

    AFTER OPENING DOOR:
    Desktop Screenshot 2023.04.14 - 12.30.23.03.png
     
    Last edited: Apr 14, 2023
  2. undeadAlic3

    undeadAlic3

    Joined:
    Oct 13, 2022
    Posts:
    2
    Hey AlexNikolay, I think it would help if you posted the code for the suspension effect, or at least the part of it that determines what moves and what doesn´t so that someone could possibly help you in finding the part of the logic that could be causing the issue.

    Now in regards to the "weight" of the box colliders, I am a bit confused, are you talking about the rigidbody set to each collider you have? If so, it would be as simple as unticking the box labelled "Use Gravity". If this is not the case, then again, I do have to stress that seeing the code and knowing what this "weight" value is, would help someone far more knowledgeable than me in solving your issue.
     
  3. AlexNikolay

    AlexNikolay

    Joined:
    Mar 1, 2022
    Posts:
    29
    Hi! I dont think that the issue is the code, because before this custom suspension system I had wheel colliders and it was the same thing with the door. I only have a rigidbody on the main car and not in each box collider that I have, such like doors and stuff like that. I also tried inserting a rigidbody on the door, but the door was worse, it was falling and bugging. And for the weight value I meant that the door with box colliders, the car was heavier and without it was lighter.
     
  4. AlexNikolay

    AlexNikolay

    Joined:
    Mar 1, 2022
    Posts:
    29
    I fixed it by just changing the mass of center of the rigidbody, thank you anyways for replying!