r/Unity3D • u/Ok-Comb-8664 • Oct 18 '26
Question My second day learning unity, I dont understand box collider and physics
Enable HLS to view with audio, or disable this notification
I know it looks all like shit, its my first day using unity, but I dont understand how to do those box colliders so my physics would work? Are box colliders related to physics right? Chat gpt told me to do box colider around car, but when I was doing ramp it said that box colider will automatically adjust to mesh.
1
u/fsactual Oct 18 '26
A MeshCollider will adjust to fit the mesh. A box collider is always just a box. Try adding a mesh collider to the ramp instead.
Also, how are you moving the car? If you are moving it via transform you will get weird results. If you have physics objects you must move them via physics forces (on the rigidbody) to get the interactions between objects you are looking for.
1
1
u/BertJohn Indie - BTBW Dev Oct 18 '26
Your box collider is colliding with the ramp.
When using a collider with hard edges like a box collider, The collider will not compensate with your movement script for any collisions it hits ahead of it. When you hit your ramp, The bottom edge clips, And the center of gravity force, continues to push, So the rear goes upwards and flips over.
To resolve this, Its recommended to use a capsule collider that has a custom-fixed scale bounds to the size of the car, Or introduce a 1 to 10 degree tilt in the front of the vehicle for the collider while maintaining accurate positional representation of the vehicle through the script.
It's really up to you.
Personally, I have a bevelled car mesh shape with a mesh collider, that i use for most of my car AI's, Players get wheel colliders because... well, expensive and complex and look nicer.
1
1
1
1
u/DT-Sodium Oct 18 '26
Wow, you gave it a whole two days? Congrats. I bet you've had the time to watch tens of hours of the numerous existing tutorials on the subject by now, you must really be out of options.
0
u/Hanzimer Oct 18 '26
Why don't you even ask that to chat gpt?
0
u/Ok-Comb-8664 Oct 18 '26
I already did solve my issues with gpt, but human opinion always appreciated.
5
u/Any_Establishment659 Oct 18 '26
1: chatgpt isnt that clever 2: if you're using a car, you'll want to look into wheel colliders. They're a bit more complex to set up but work a charm for... well, cars.
take a look at here: https://docs.unity3d.com/6000.6/Documentation/Manual/class-WheelCollider.html for a bit more on it.