- Home /
How can i stretch an object in unity?
Is there any way i can stretch a line in unity to go in a certain direction. I tried using a line renderer but it couldn't detect when it hit another object. I have done a lot of research, but i haven't found anything that has related to my situation. Any help would be appreciated!
You're not very clear about what you want to know. You can stretch an object using the scale of the Transform, but I know that's not what you're asking. Raycasting might be what you're looking for, but I'm not sure.
Of course line renderer will not detect if it hits something. What you need to do is to raycast forward from your gun, if it hits something set lineRenderer point 1 to hitPoint.point position. if raycast doesnt hit anything, set the point one position to vector forward * beam$$anonymous$$axLength(which is your variable).
FYI: there are dozens of post related to your situation on here.
I just need a black line to grow in one direction and detect when it hits something. I probably will try to use raycasting for the line collision detection
Thank you for the help though...
Your answer
Follow this Question
Related Questions
Stretch Colliders when changing resolutions ? 0 Answers
Default plane collider doesnt work properly when stretched? 0 Answers
Internal collisions 1 Answer
Problems with 2D Collision/Trigger 0 Answers