x


Need collision geometry visible in the editor but not in game

I'm building collision around my render geometry using mostly Cube game objects. In order to work with them easily in the editor (I'm using Unity 1.5 for iPhone), I have the Mesh Renderer for each one enabled so I can see them. But when in the engine, I only want them to collide but not render.

I've thought of writing a script that turns off rendering for all objects tagged "collide", but that feels a bit clunky to me and might give me a little hiccup as the level loads (just guessing). Has anyone come up with a good workflow for working with visible collision in the editor but have it invisible in the game?

more ▼

asked Dec 10 '09 at 07:35 PM

rocket5tim gravatar image

rocket5tim
859 12 17 33

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

2 answers: sort voted first

Put all of the collision geometry on a separate layer, go to your Camera, where it says Culling mask, click on Everything and uncheck the layer that your collision geometry is on.

more ▼

answered Dec 10 '09 at 10:12 PM

Stelimar gravatar image

Stelimar
3k 14 16 50

That's brilliant! Thanks!

Dec 10 '09 at 11:03 PM rocket5tim

Great solution; I'd vote it up if I could.

Apr 03 '12 at 02:53 AM RustyTheBoyRobot
(comments are locked)
10|3000 characters needed characters left

I've taken to designing my colliders in Blender, using meshes, and converting the meshes to colliders upon import. This is part of a larger scheme, in which I do all my level editing externally, and then sync with FBX files.

It's kind of like this, only it allows for mesh editing instead of just scaling a unit primitive. (This example doesn't really provide support for capsule colliders, but mine works fine with those.)

Let me know if you're interested. I'm going to release my solution to the wiki after I finish putting it through its paces on my current game. I'm still adding features and cleaning it up, but it does work.

more ▼

answered Dec 11 '09 at 02:18 AM

Jessy gravatar image

Jessy
15.7k 72 95 198

Looks like a good solution Jessy, thanks for the link.

Dec 11 '09 at 01:54 PM davebuchhofer

I'm using a later version of this, but feel free to try it and/or modify it to your liking until I make the wiki entry.

http://forum.unity3d.com/viewtopic.php?t=33308

Dec 11 '09 at 11:05 PM Jessy
(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
x1728

asked: Dec 10 '09 at 07:35 PM

Seen: 2073 times

Last Updated: Apr 03 '12 at 02:53 AM