|
Why I want to use layer for? I know I can isolate GO (Game object) from the scene, but to do what? Why doing that?
(comments are locked)
|
|
From the docs:
Tags are similar to layers, in that you can use them to mark/group GameObjects. However, tags are "intended to identify GameObjects for scripting purposes," while layers are "used to define how Unity should render GameObjects in the Scene." If you need to identify certain objects from your scripts (such as enemies, asteroids, walls, etc.), use Tags. If you need to control how certain GameObjects are rendered, use Layers.
(comments are locked)
|
|
Also, selective raycasting - as in only raycasting against colliders in specific layers as opposed to raycasting against all colliders. Example:
For more information on masks and layer masks, check out the How do I use layermasks? question.
(comments are locked)
|
|
Gabriel, can you please explain a bit about selective raycasting? I can't find anything about it in the docs. For examples see the page on Unity Layers, near the bottom: http://unity3d.com/support/documentation/Components/Layers.html All the Physics.Raycast calls take a layer mask as an optional argument. The mask lets you test for a hit against objects in only some of the layers, rather than all.
Dec 15 '09 at 12:15 PM
Bampf
I added the description - along with a code example to Gabriels answer.
Dec 16 '09 at 09:26 AM
AngryAnt ♦♦
Excellent! Thank you both!
Dec 17 '09 at 02:25 AM
Goody!
(comments are locked)
|
