- Home /
Question by
ycy_21004 · Sep 06, 2020 at 06:16 PM ·
animationspritegraphicscollider2d
2D Sprite, Animation Question
I want to play an animation that a laser is fired from the starting point. It is easy. The problem is when the laser meets an obstacle, the laser behind the obstacle won't be fired anymore just like the picture. I'm using box collider 2D. The important thing is that animation should be natural without lagging. Plz help me :(
1.png
(17.0 kB)
Comment
Answer by N-8-D-e-v · Sep 06, 2020 at 07:33 PM
This will be tricky, you might success using multiple line renderers and raycasts. You can stack the line renders on top of each other to form a rectangle, and shoot raycasts that line up with each line renderer. Then, just have each line renderer render a line from the start position to the raycast's hit.point