How to add collisions to any Trail Renderer (featuring object pooling)

Описание к видео How to add collisions to any Trail Renderer (featuring object pooling)

In this video I'll go over how to set up EdgeCollider2D collisions for your trail renderer with a c# script you can put on your trail renderer game object. I also go over how i set object pooling to reuse unused edge collider components.

Final version of TrailCollisions script can be found here:
https://pastebin.com/5y48DsFj

My MouseTrail script I use for showcasing purposes:
https://pastebin.com/0jHFrgmS

Disclaimer: I am not 100% sure that is object pooling, nor am i 100% sure it was necessary to pool those colliders in my example cases

ps. I believe you could also add -transform.position to your edge collider offset every frame to solve the shifting collider issue.

0:00 the basics
0:18 shift issue
0:47 dealing with unused colliders
1:04 pooling

#unity #tutorial #collisions #trailrenderer

Комментарии

Информация по комментариям в разработке