How to make a beam from several points in space

Hello, I have a game where there are projectiles that have bullet drop. The projectile does not use the game physics or gravity, instead i have a module that calculates where the projectile should go. I want to have a beam to show the trajectory of the projectile with a beam, but ones that I found don’t line up exactly because they use workspace.Gravity in their formula. How do i make a beam out of several 3d points or just use the formula? Thanks!

Posts I’ve tried:

Does not work well because it uses gravity in its formula.

Does not work either it points straight down for some reason.

1 Like

Soo you want to make a beam bullet go forward? Just use the Cframe lookvector and add it in a loop!

2 Likes

Oh I forgot to mention it has bullet drop, I have code to simulate gravity in a way that makes the bullet fall down but I want to have a beam to show the trajectory of it. How do I do this?

I belive using the cframelookvector then minus it with vector3 y value. It should look like this
Cframe.new(position+lookvector,position+lookvector-Vector.new(0,gravity,0)
The more gravity it is the more faster it will drop to the ground

Yes you’re right, that’s how I did it. But how do I convert this into a beam?

1 Like

Hmm, you could try making a folder and then use a renderstepped to create each position on the beam. Then repeat it every frame?

1 Like

I tried it, but it lags a lot because each time where will be around 1k beams in workspace and every second 60 beams are created. Also everytime the player moves their mouse it will have to do it all again. So I’m not sure how I can do this without having performance issues. Is there a way to do it all in one beam? Maybe using math to calculate the curvesize 0 and curvesize 1

Use a table to virtually map out the bullet as if it were moving and map each point to the table. So you should have a table of cframes. Use that to illustrate your trajectory.

I now have a table of CFrames. How do i use that to illustrate my trajectory using one beam?

I manage to solve the problem. I just had to iterate through a table of Vector3 values and create beams through them with a CurveSize1 of the difference between the Y value of attachment 0 and the Y value of attachment 1.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.