ROR 2 rockets math [Physics]


OBS is lagging mb all + my pc specs are bad
Its not 1:1 recreation but close

https://gyazo.com/ef3b666192dc4e44ca050f4f34f61b85
extra clip

local RunService = game:GetService("RunService")
local function Cast(Caster:Part,Target:Part,Speed,RotationSpeed)
	Speed = 40
	RotationSpeed = 4
	local function Projectile()
		local pr = Instance.new("Part")
		local vel = Instance.new("LinearVelocity")
		local att = Instance.new("Attachment")
		pr.Material = Enum.Material.Neon
		pr.Color = Color3.new(1, 0.298039, 0.905882)
		att.Parent = pr
		
		vel.Parent = pr
		vel.VectorVelocity = Vector3.new(0,Speed,0)
		vel.Attachment0 = att
		
		pr.Parent = workspace.Debris
		pr.Anchored,pr.CanCollide,pr.CanQuery,pr.CanTouch,pr.CastShadow = false,false,false,false,false
		pr.Size = Vector3.new(0.4,0.4,2)
		
		return pr,vel
	end
	
	local C_1,C_2,C_3 :RBXScriptConnection = nil
	local count = 0
	local pr,vel = Projectile()

	local Caster = Caster or workspace:WaitForChild("Caster")
	local Target = Target or workspace:WaitForChild("TargetPart")
	
	pr.CFrame = CFrame.lookAt(Caster.Position,Caster.Position + Vector3.new(0,5,0))
   
	
	C_1 = RunService.Heartbeat:Connect(function(dt)
		count+= dt
		if count >= 0.4 then
		    
			vel.VectorVelocity = CFrame.lookAt(pr.Position,(pr.CFrame * CFrame.new(0,0,-10).Position)).LookVector * Speed
			pr.CFrame = pr.CFrame:Lerp(CFrame.lookAt(pr.Position,Target.Position),dt * RotationSpeed)
		end
		if count >= 5 then
			pr:Destroy()
			C_1:Disconnect()
		end
		
	end)
end


while true do
	Cast()
	task.wait(1)
end
5 Likes

Me when video freezes every 1 second for like 15 seconds (literally it is like I said)

ROR 2 is Risk Of Rain 2?

Yea ror 2 is risk of rain 2

i dont have good specs to provide clips

1 Like

Its just video playing is freezing itself

Looks good though (Iā€™m bad with math)