Yeah, it’s the same but you will still need to tell the beam the shape of the projectile and where it’s going to which it will calculate using those 4 parameters.
Here is an example tool I took from an old topic I helped out a long time ago.
Create a tool in starter pack, and insert this as a local script
local tool = script.Parent
tool.RequiresHandle = false
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local DB = false
local function createBeamInProjectileMotionPath()
local attach0 = Instance.new("Attachment")
local attach1 = Instance.new("Attachment")
local beam = Instance.new("Beam")
beam.Color = ColorSequence.new(Color3.new(1, 0.035294, 0.035294))
beam.Attachment0 = attach0
beam.Attachment1 = attach1
beam.Parent = workspace.Terrain
attach1.Parent = workspace.Terrain
attach0.Parent = workspace.Terrain
return beam, attach0, attach1
end
local function beamProjectile(g, v0, x0, t1)
-- calculate the bezier points
local c = 0.5 * 0.5 * 0.5
local p3 = 0.5 * g * t1 * t1 + v0 * t1 + x0
local p2 = p3 - (g * t1 * t1 + v0 * t1) / 3
local p1 = (c * g * t1 * t1 + 0.5 * v0 * t1 + x0 - c * (x0 + p3)) / (3 * c) - p2
-- the curve sizes
local curve0 = (p1 - x0).magnitude
local curve1 = (p2 - p3).magnitude
-- build the world CFrames for the attachments
local b = (x0 - p3).unit
local r1 = (p1 - x0).unit
local u1 = r1:Cross(b).unit
local r2 = (p2 - p3).unit
local u2 = r2:Cross(b).unit
b = u1:Cross(r1).unit
local cf1 = CFrame.new(x0.x, x0.y, x0.z, r1.x, u1.x, b.x, r1.y, u1.y, b.y, r1.z, u1.z, b.z)
local cf2 = CFrame.new(p3.x, p3.y, p3.z, r2.x, u2.x, b.x, r2.y, u2.y, b.y, r2.z, u2.z, b.z)
return curve0, -curve1, cf1, cf2
end
local function createAndSetBeam(g, v0, x0, endTime, color)
local t1 = endTime or 1 -- projectile time when in expires, or any number you want tbh
local curve0, curve1, cf1, cf2 = beamProjectile(g, v0, x0, t1)
local beam, attach0, attach1 = createBeamInProjectileMotionPath()
beam.CurveSize0 = curve0
beam.CurveSize1 = curve1
beam.FaceCamera = true
beam.Segments = 10 * math.round(t1 * 3)
if color then
beam.Color = ColorSequence.new(color)
end
-- convert world space CFrames to be relative to the attachment parent
attach0.CFrame = attach0.Parent.CFrame:Inverse() * cf1
attach1.CFrame = attach1.Parent.CFrame:Inverse() * cf2
return beam, attach0, attach1
end
tool.Activated:Connect(function()
local hrp = player.Character.HumanoidRootPart
if not DB then
local comet = Instance.new("Part")
comet.Size = Vector3.new(2,2,2)
comet.CanCollide = false
comet.CFrame = hrp.CFrame
comet.Parent = game.Workspace
local antiGravity = Instance.new("BodyForce")
local antiGravityFactor = 0.9--1 = gravity force counteracted, 0 = no force lol
antiGravity.Force = comet:GetMass()*workspace.Gravity*antiGravityFactor *Vector3.new(0,1,0)
antiGravity.Parent = comet
local appliedVelocity = (CFrame.new(hrp.Position,mouse.Hit.Position).LookVector * 50)
comet.AssemblyLinearVelocity = appliedVelocity
local gravity = Vector3.new(0,-Workspace.Gravity*(1-antiGravityFactor),0)
createAndSetBeam(gravity, appliedVelocity, hrp.CFrame.Position, 1)
spawn(function()
DB = false
wait(5)
comet:Destroy()
end)
end
end)
Also you will notice setting the end time as t1 = 1 will create a beam because thats where the projectile will be after one second with the beam will go towards and stop at that point, this is what happens if you set it to t1 = 30 from Ego Mooses beam formula.