How to get the end point of a beam or length of a beam

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to get the point where the beam collides with the ground
  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Getting the attachment position

Fire a ray from the beam’s start position to the finish point using raycasting, then get the position from the result + the distance.

1 Like

What’s the finish point? I’m trying to figure out what the finish point is, the beam also goes through the ground

You can detect if the ray hit another part. Are you using parts or attachments for the beam?

Attachments, since the point of this is also an artillery system I can’t just go for a straight shot or else it won’t go to where its going to impact.
image it goes through this part

Based on Position, you would do:

(StartAtt.WorldPosition - EndAtt.WorldPosition).Magnitude

This will return the length of the Beam between start to end

You would set the End Position using Raycast doing:
Rasycast.Position + Raycast.Normal

Or, you can use Mouse.Hit if you are using the Player

1 Like

Raycasts are in too straight of a line, I need it to arc, is there a way for me to make like a proxy part follow the curve and do hit detection from there?

I know you can do some curving stuff with bezier curves but I didn’t get to learn it. There are videos online of it.