- Home /
How do I prevent my object from going through certain walls?
Hi
My FPS Player is going through some walls and not through others.
I want to make all walls solid.
I created this in C4D.
Thanks, Chris
Answer by AngryAnt · Mar 18, 2010 at 10:50 AM
I'm assuming you created your level geometry completely in C4D and then when importing ticked "generate colliders".
While this works well for quick tests and single complex objects, you should generally use simple colliders to mark up your scene in Unity. Not only are these much cheaper performance-wise, but also more precise. This also ensures that you know exactly what is going on in your scene physics-wise.
Approach:
- Disable "generate colliders" for your geometry.
- Add the geometry to your scene - of if it is already there, make sure that it has been updated to not have a mesh collider attached.
- For each wall and other elements in the geometry hierarchy in the hierarchy view, attach a box collider (or one of the other simple colliders from the Components -> Physics menu and size it to fit with the element.
- Profit!
Notice that it is a good idea to make the colliders a bit too "tick" - in case of walls you could just ensure that the excess collider is inside the walled up area. This helps make sure that the collider is respected by fast moving objects.
Answer by equalsequals · Feb 18, 2010 at 12:28 AM
The only thing I can think of is that the normals on your collision geometry might be inverted from what you are expecting.
You will have to be more specific in order to get a more accurate answer, but I find that is a general problem I see upon receiving geometry from other artists during integration.
Cheers,
==
Answer by Litobyte Softworks · Feb 18, 2010 at 03:21 AM
Sometime the speed of the player can be an issue...but is is also related with the TIMING your game use (Project/Time options) and also the physics.
Is your FPS player a rigidbody ?
Does it fall madly from big heights ?
Be more specific!
There is a script in the WIKI which use RAYCASTING for avoiding these problems, but usually, you won't need it.
Don't ask ask questions in the answer.. it suppose to be an answer.. consider asking the questions as comments and the just answering the question. Regards
Your answer
Follow this Question
Related Questions
Camera gets flung off of the map when the player collides with certain objects. 0 Answers
How can i create a character like dragon hill game, Digging underground, what collider should i use? 0 Answers
Projectile/Shield Collisions with Friendly Projectiles Passing Through 1 Answer
Object with rigidbody bounces after hit. 0 Answers
Physics.IgnoreCollision not working 0 Answers