I making 2D unity game but I am facing a major issue which my game depends on.
I attached a trail renderer component to my player and what I need is to make the renderer be a collider act as a MeshCollider I just didn't figure out if it is possible to make a collider to take the shape of a 2D trail renderer.
I've searched over google but didn't have a well performing solution:
- Some say create an empty gameobject attach the trail renderer component then add a collider to it. But doesn't work neither.
- I tried to follow this WIKI and My Trail Renderer collides but is not nice but I need to assign the tag to the trail too.
Is there some script I can write to achieve my goal Or UnityEngine
has a
render solution.Thanks in advance.
EDIT1:
After I copied the script and run it The trail collides but it acts goofy when player is not moving.
EDIT2:
The game basically is a player that has transform.position
equal to the mouse position.So the trail doesn't have a specific length.