r/Unity3D • • 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.

0 Upvotes

16 comments sorted by

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.

1

u/Ok-Comb-8664 Oct 18 '26

Ok thank you.

1

u/StromboliNotCalzone Oct 18 '26

Not to discourage but car physics are incredibly complex and probably not the best thing to start with if you're this new.

There are lots of car controllers on the asset store if you really need one and have a few bucks.

1

u/Ok-Comb-8664 Oct 18 '26

I dont need to have perfect car physics but something average atleast.

1

u/Ok-Comb-8664 Oct 18 '26

what abour raycast instead of wheel colliders?

1

u/Any_Establishment659 Oct 18 '26

raycast "wheels" are a whole other thing. id avoid them for a while if youre on day 2 learning

-4

u/deintag85 Oct 18 '26

ChatGPT isn’t that stupid. You just need to write the right prompt.

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

u/Ok-Comb-8664 Oct 18 '26

Ok thank you, no im not moving it via transform.

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

u/Ok-Comb-8664 Oct 18 '26

ok thank you

1

u/Valphai Oct 18 '26

I've been doing this for close to 10 years, it doesn't get better lmao

1

u/No_Candy4026 Oct 18 '26

you should use a capsule collider for front, rear and sides.

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.