- Home /
How to check of a line renderer collides with ground ?
I use a line Renderer to draw a trajectory graph for a granate throw. I want, that when the Line hit any ground, it stops and paint a texture on the ground. How can i do that ? The texture thing is not that important but would be cool.
Answer by Nimred · Apr 27, 2016 at 10:58 AM
You would have to make a script that iterates over the lines of your trajectory, casts a physic ray for each line, and checks for the first collision along the trajectory. Actually, for performance reasons it's best to cast one ray for multiple lines, as you probably want the rendered lines to be pretty small, but you don't want that many raycasts. There's probably more optimizations to be made depending on your project, but that's a start.
Nice Answer so a Line Renderer has a list of 3dVectors wich are used to build the graph line. I have to so a ray cast from the first point to the direction of the second point and check if ther is a collision than from the second to the therd and so on ? Is there a way how i can send a ray cast just from one point to the next and look if there was an collision between this two points ?
Your answer
Follow this Question
Related Questions
Bezier curver using LineRenderer 0 Answers
LineRenderer. Problem with ray displaying 2 Answers
Line Collision Detection for 2D Game 1 Answer
Line Renderer Ilumination 1 Answer