x


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

more ▼

asked Feb 17 '10 at 10:06 PM

cmos gravatar image

cmos
467 29 40 54

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

3 answers: sort voted first

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.

more ▼

answered Mar 18 '10 at 10:50 AM

AngryAnt gravatar image

AngryAnt ♦♦
4k 14 19 52

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

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,

==

more ▼

answered Feb 18 '10 at 12:28 AM

equalsequals gravatar image

equalsequals
4.5k 16 28 64

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

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.

more ▼

answered Feb 18 '10 at 03:21 AM

Litobyte Softworks gravatar image

Litobyte Softworks
37 2 2 6

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

Mar 04 '10 at 01:37 PM Lipis
(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:

x2584
x1947
x1765

asked: Feb 17 '10 at 10:06 PM

Seen: 3637 times

Last Updated: Mar 18 '10 at 10:53 AM