Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local i = Vector3.new()
- local n = 0;
- game:GetService("RunService"):BindToRenderStep("Movement",Enum.RenderPriority.Camera.Value - 1,function(Num_dt)
- local V3_add = Vector3.new()
- for i,v in pairs(ControlManager.MovementKeysDown) do
- if i == Enum.KeyCode.W then
- V3_add = V3_add+Vector3.new(0,0,-1)
- elseif i == Enum.KeyCode.S then
- V3_add = V3_add+Vector3.new(0,0,1)
- elseif i == Enum.KeyCode.D then
- V3_add = V3_add+Vector3.new(1,0,0)
- elseif i == Enum.KeyCode.A then
- V3_add = V3_add+Vector3.new(-1,0,0)
- end
- end
- if V3_add.Magnitude > 0 then
- ControlManager.IsRunning = true
- local V3_dir = V3_add/(V3_add.Magnitude)
- if ControlManager.Camera then
- print("Begin: "..tostring(n).." - "..tostring(tick()))
- --[[
- -- local CF_hrp = Inst_player.Character.HumanoidRootPart.CFrame
- -- local V3_lv = ControlManager.Camera.Camera.CFrame.lookVector
- --
- --
- --
- --
- -- local CF_pos =
- -- CFrame.new(
- -- CF_hrp.p,
- -- (CFrame.new(CF_hrp.p)*CFrame.new(V3_lv.X,0,V3_lv.Z)).p
- -- )
- -- *CFrame.new(V3_normal*ControlManager.SpeedMultiplier*(Num_dt))
- --
- -- local V3_cPos = Vector3.new(V3_lv.X * V3_normal.X,0,V3_lv.Z * V3_normal.Z)
- --
- -- print((CF_pos.p - i).magnitude,V3_normal)
- -- i = CF_pos.p
- --
- --
- -- local CF_rot = CF_hrp - CF_hrp.p
- --
- -- Inst_player.Character:SetPrimaryPartCFrame(CFrame.new(CF_pos.p)*CF_rot)
- ]]
- local CF_curHrp = Inst_player.Character.HumanoidRootPart.CFrame
- local V3_camLv = ControlManager.Camera.Camera.CFrame.lookVector
- local CF_rot = CFrame.new(Vector3.new(),Vector3.new(V3_camLv.X,0,V3_camLv.Z))
- local CF_hrpPos = CFrame.new(CF_curHrp.p)
- local CF_deltaCF = CFrame.new(V3_dir*ControlManager.SpeedMultiplier*Num_dt)
- local CF_new = CF_hrpPos*CF_rot*CF_deltaCF
- print((CF_new.p - i).magnitude,"\t \t \t",CF_rot.p.magnitude,"\t \t \t",CF_deltaCF.p.magnitude,"\t \t \t",V3_dir)
- i = CF_new.p
- Inst_player.Character:SetPrimaryPartCFrame(CF_new)
- --Inst_player:Move(V3_dir,true)
- print("End: "..tostring(n).." - "..tostring(tick()))
- n = n + 1
- end
- else
- ControlManager.IsRunning = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement