Projectile system with Prediction

So I’m currently trying to make a projectile system with a curve system and It would have a feature where it show a prediction path similar to the game named “BedWars”.

I’ve made some code for the projectile and the curve system [They’re not that great] but couldn’t get my hands on the prediction system. Any help would be greatly appreciated.


function module.Shoot(Position1, Position2, ObjectName)

	local Direction = Position2 - Position1
	local Duration = math.log(1.001 + Direction.Magnitude * 0.01)

	Position2 = workspace.pos.Position+ workspace.pos.AssemblyLinearVelocity * Duration
	Direction = Position2 - Position1

	local Force  = Direction/Duration + Vector3.new(0, game.Workspace.Gravity * Duration * 0.5,0)




	local Object = ObjectsThrown:FindFirstChild(ObjectName):Clone()
	Object.Parent = workspace
	Object.Position = Position1 

	Object:ApplyImpulse(Force * Object.AssemblyMass)
	Object:SetNetworkOwner(nil)
end

I believe they are using a beam, and positioning a attachment to where the projectile is going to end by using math.

Yeah. They are using a beam but that’s not the problem. The problem is how did they do the math?

The math part is complicated, just use your current formula.

I recommend running checks and positioning the attachment where it lands, might not be the best method, but get’s the job done.

The math has already been done before

2 Likes

Seems to work fine. One question though is there a possible way to not let the physics change the Orientation of the object? I want to add an Orientation tween for the gift.
image

Any help is appreciated!