[Memo-Unity] 13. MaskLayer

์—…๋ฐ์ดํŠธ:

์นดํ…Œ๊ณ ๋ฆฌ:

ํƒœ๊ทธ: ,


MaskLayer , Trail Renderer

MaskLayer








1. MaskLayer

MaskLayer์„ ํ†ตํ•ด ์ถฉ๋Œ ์กฐ๊ฑด
์‚ฌ์šฉํ•  ๋ ˆ์ด์–ด๋ฅผ ์ถ”๊ฐ€ ( 6 : Enemy, 7 : Level, 8 : Player )
image

if (levelCollisionLayer.value == (levelCollisionLayer.value | (1 << collision.gameObject.layer)))
{
    Debug.Log(levelCollisionLayer.value);           // 10000000
    Debug.Log(collision.gameObject.layer);          // 7
    Debug.Log(1 << collision.gameObject.layer);     // 10000000
    Debug.Log((levelCollisionLayer.value | (1 << collision.gameObject.layer)));
    DestroyProjectile(collision.ClosestPoint(transform.position) - _direction * .2f, fxOnDestory);
}

์ž˜๋ชป๋œ ์ƒ๊ฐ ์ˆ˜์ •

(1 ยซย collision.gameObject.layer)
์ด ์ฝ”๋“œ๊ฐ€ collision.gameObject.layer ๋ฅผ 1๋งŒํผ ยซย ํ•œ๋‹ค๊ณ  ์ž˜๋ชป ์ƒ๊ฐํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.
๋น„ํŠธ์—ฐ์‚ฐ์ž์— ๊ด€ํ•˜์—ฌ ์ž˜ ๋ชจ๋ฅด๊ณ  ์žˆ์—ˆ๊ณ , debug ๋ฅผ ์ฐ์–ด๋ณด๋‹ˆ ์•Œ๊ฒŒ๋˜์—ˆ๋‹ค.

1์„ collision.gameObject.layer(7) ๋งŒํผ ยซย ํ•˜๋Š” ๊ฑฐ ์˜€๋‹ค.
= 10000000 = levelCollisionLayer.value
levelCollisionLayer.value = 128 = 10000000 collision.gameObject.layer = 7








Trail Renderer

์›€์ง์ด๋Š” ๊ฒŒ์ž„ ์˜ค๋ธŒ์ ํŠธ ๋’ค์— ํด๋ฆฌ๊ณค ํŠธ๋ ˆ์ผ์„ ๋ Œ๋”๋ง ํ•œ๋‹ค.

image

width, color, Materials

image








์ •๋ฆฌ




[Unity] MaskLayer TOP


๐Ÿ“”

๋Œ“๊ธ€๋‚จ๊ธฐ๊ธฐ