- Home /
Trail Renderer detection
Hello,
How can i detect a trail renderer or a line renderer drawn by the player with mouse button? I have no idea how to scan the draw made by the player.
The desired effect is like this minigame: https://www.youtube.com/watch?v=0JE3Qgwluz8
Forget the trail renderer; keep a record of where the brush has traveled. Do this by adding a new vertex to a collection of verts every X distance the brush moves. I guess you could do this with the trail renderer itself, but I wouldn't want to.
Extrapolating useful information from this collection is a whole different story. If you really are re-creating this $$anonymous$$igame's mechanics, the easiest way to analyze player activity involves having a high-poly pre-existing mesh shape you've created which the player is trying to match. Exa$$anonymous$$ing the brush's "traveled path" collection and checking for proximity to verts in the shape you're tracing would tell you roughly how accurate their tracing was.
Doing anything more complicated gets into stuff like gesture and handwriting analysis, which is a deep and complex topic. Perhaps 3rd party solutions exist which can make life easier. It all really depends on what you need this information to do for you.
What if i establish a colision path on the object that i want to be painted by the player and check if the collision of his brush enters all the collision of the object? I will try putting smaller gameobjects with collision triggers in the front of the object that i want to be painted and check with booleans or with a int counter if the collision of brush pass by all of them. Thanks for the idea!
How well that'll work depends upon how much accuracy you want, and whether you want to penalize the player for mistakes. Your way is fine only if you don't care whether the player makes errors. With your suggestion, the player could spend 30 $$anonymous$$utes doodling in the margins without penalty, or otherwise make errors which won't be caught. It all depends upon what you want. :)
I can reduce the size of the paint collisions enough to the size of the brush collision. I was thinking about highlight the objects that the player had passed with his brush. The player just needs highlight all objects to solve the puzzle.
Your answer
Follow this Question
Related Questions
2d bullet trail 0 Answers
Line Renderer Ilumination 1 Answer
2D renderer with particles on UI 1 Answer
Manually add vertext to TrailRenderer? 1 Answer
Trail renderer not rendering over sprite background 4 Answers