![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | demon3o5z |
I’m trying to get a character to fire a laser that has a set maximum range, but stops and adjusts length when it hits a surface. I know there are tutorials for making lasers using rays, but I’ve also got a sprite that needs to adjust it’s length so that it matches the range of the ray.
here’s the logic of what I’m trying to get to:
I have a sprite that’s the child of a ray
if ray is not colliding
set sprite.texture width to ray length
if ray is colliding
set sprite.texture width to the difference between ray’s origin point to collision point
I haven’t even gotten to adjusting the length based on a collision point because I can’t get the texture to match the ray.
Any suggestions would be appreciated.