x


Rigidbody Collision?

Hello there, Well its pretty easy i think so lets start with what i have:

A level: this is a model imported from Maya with a Mesh Collider

A vehicle: this also is a model from Maya which is imported and has a Mesh Collider

Now what im trying to do is add physics to the vehicle so i added a Rigidbody (i do not know if this was the right thing to do though)

And when i played my scene the vehicle starts to fall and falls straight trough the level without any kind of collision.

What i was expecting is that it would hit the level and just stop there because it has colliders, also i tried this with the FPSWalker component, and that did work, though i want a physics object and not the FPSWalker.

Could anyone please explain me what i am doing wrong or give me some directions on how i can have my physics object collide correctly?

Greetings, TheMPC

more ▼

asked Apr 20, 2010 at 01:12 PM

TheMPC gravatar image

TheMPC
93 11 10 20

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Instead of using a mesh collider for the car use box colliders to approximate the shape, this is not only faster but also more accurate for fast car simulations.

Make sure that the terrain has a mesh collider, sometimes just importing a mesh doesn't give you any colliders. Click on the level, click on component > physics > mesh collider, it should appear as a component, the mesh variable should say the name of your mesh and the project view will show a wire frame of the mesh collider, if not it's not worked properly and you need to pick a mesh to drag into the slot. Have you tried creating a unity terrain instead? You can import your buildings and things to go on top of it.

Generally speaking with driving games it's best not to use thin colliders like lamp posts as your car can get stuck in them at high speeds. Here's a section on wheel colliders, wheel colliders can help you simulate things like wheel slip.

Here is a tutorial for a driving game that uses wheel colliders

more ▼

answered Apr 20, 2010 at 02:17 PM

spinaljack gravatar image

spinaljack
9.8k 27 50 120

Thank you for the helpfull information, will reply beack to this post once i tested the sollution tomorrow.

Apr 20, 2010 at 03:54 PM TheMPC

I'd like to add a related newbie question: Using Mesh Colliders for level objects and a character controller for the player, I am currently walking (translating) through walls. Is this correct behaviour?

Should I use CharacterController.Move instead of Transform.Translate for player movement? And what about mobs/enemies? What colliders / movement function should they use?

Thank you and apologies for the triviality of my question...

Apr 19, 2012 at 03:43 PM gl03
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x4312
x3231
x3216

asked: Apr 20, 2010 at 01:12 PM

Seen: 5653 times

Last Updated: Apr 19, 2012 at 03:43 PM