- Home /
Basic Collision, Object + First Person
Alright, So I have a door that I've made in blender and I want the character to stop when it hits it, I.E not have the ability to pass through, I have a whole town and map set up that I've created in blender and I can walk through all of it. If I add box-colliders the objects just dissapear, I've also set them all to gameObjects. If anyone is going to direct me towards scripting I understand C# the most, although I can convert from javascript. I just want basic collision and I'm not understanding how to get it. I'm not looking for some high-grade physics, but not walking through houses/walls would be nice. Having a script for opening and unlocking doors is useless if you just pass through them.
EDIT: I've set mesh coliders and rigidbodies, but still nothing. I just walk straight through.
Answer by cdrandin · Jan 10, 2013 at 03:16 AM
When importing your models Unity offer an option to "Generate Colliders". Enable that and check what happens. Also don't forget to hit "Apply" at the bottom of the menu
On the inspector panel when you are viewing an imported object. So say you have already imported your asset and it is in your project panel. Left click that object and the importing option panel will go where the inspector panel typically is. Then just do as mentioned before. If still problems try providing the building to have someone test it and check if it isn't the model its self for some reason.
Answer by aardvarkk · Jan 10, 2013 at 02:45 AM
I'm just getting back into Unity, so take this answer with a grain of salt, but can't you convert your whole level mesh into a big collision mesh? Then you'll collide with all of it...
When I try to add any type of collision using the Component menu, the object is no longer visable, and I can still walk through where it would originally be.
Have you tried adding a $$anonymous$$esh Collider to whatever mesh you were trying to collide with? In a sample project, this works when I add a $$anonymous$$esh Collider to a Cube, for instance. Is this what you're looking for? http://docs.unity3d.com/Documentation/Components/class-$$anonymous$$eshCollider.html
When I attempt to do this, the object is no longer there. Once I hit play, the object cannot be seen and has no collision.
Also, I've gotten it to load without the object beco$$anonymous$$g non existant, although there is not a collision deteection of any type. I can walk straight through it.