I have been working on a tron game and the only thing i have left to do is make a trail render collide but i’m not sure how to go about doing that. Iv tried doing particles but i cant get the particles to come out in a wall like fashion. If anyone has any pointers please help thank you.
3 Answers
3This is a bit late, but I wrote a script for a trail renderer that detects 2D collisions. You can find it on the Unity wiki: http://wiki.unity3d.com/index.php/TrailRendererWith2DCollider.
For some reason your script does not work as it used to in Unity 2019 version. It worked fine until 2018 version. I was not using it for detecting collisions, but I was using it because unlike the default trail renderer, this renderer would not change its view when the player object turned or moved (did not change alignment with respect to camera) and therefore was perfect to highlight the path the player took. Could you help here ?
– pranav_ps95Take the game object the TrailRenderer is attached to and add a Collider and a Rigidbody. Move the object through physics (AddForce() for example), and check for collisions. If you are using a character controller, you can use OnControllerColliderHit() and have the player object detect the collision.
I smiled at your title too after @nsxdavid pointed it out since “people” can be taken to be real people or game objects.
I have figured out how to make it hit like the walls and stuff but im a noob at scripting so i cant figure out how to get it to hit the trail renderer because the trail renderer isnt like phisical but a wall is. Also how do i use OnControllerColliderHit() im sorry i just dont understand
– Agent-6141Think 'Tron Light Cycle' =] ![alt text][1] Have a look at this : http://answers.unity3d.com/questions/285040/draw-a-line-in-game.html [1]: http://img.youtube.com/vi/-3ODe9mqoDE/0.jpg
– AlucardJayThanks ill try this out, here's a link if you want to see how far i have gotten on this game. http://www.youtube.com/watch?v=V4mNjjMgsGQ
– Agent-6141What exactly do i attach the script to, i attached it to the bike and it didnt do anything... im sorry if i sound dumb im just trying to learn thanks for the patience.
– Agent-6141It needs to be attached to whatever object you are using to move the position of your trail renderer. 'time' needs to be set to the same value you use for the trail renderer. The objects moving into the tail need to have colliders.
– robertbuThis is crazy that this thread is still rolling hahaha @pranav_ps95
Here is a link to a video that contains all my project files for when I worked on this a long time ago, if you look at my scripts, you may find what you need
Points for funniest question title!
– nsxdavidhow is it funny?
– Agent-6141Its funny like "I cannot destroy my children", to us that seems normal, but to a non-programmer .... =]
– AlucardJay