View difference between Paste ID: W4ECMcWt and 3zGYFJ1Y
SHOW: | | - or go back to the newest paste.
1
wait(2)
2
3
local InputService=game:GetService("UserInputService")
4
local Camera=game.Workspace.CurrentCamera
5
local Player=game.Players.LocalPlayer
6
local Character=Player.Character
7
local Head=Character.Head
8
local Torso=Character.Torso
9
local RootPart=Character.HumanoidRootPart
10
local RootJoint=RootPart.RootJoint
11
local Neck=Torso.Neck
12
Camera.FieldOfView=90
13
Camera.CameraType="Scriptable"
14
InputService.MouseBehavior=Enum.MouseBehavior.LockCenter
15
port = Instance.new("Part", game.Players.LocalPlayer.Character)
16
port.Transparency = 1
17
port.CanCollide = false
18
port.Anchored = true
19
port.Name = ("parted")
20
21
local plr = game.Players.LocalPlayer
22
plr.Changed:connect(function(change)
23
if (change == "Character.parted") then
24
plr.CameraMode = "Classic"
25
script.Disabled = true	
26
script:Destroy()
27
end
28
end)
29
30
31
local v3=Vector3.new
32
local cf=CFrame.new
33
local components=cf().components
34
local inverse=cf().inverse
35
local fromAxisAngle=CFrame.fromAxisAngle
36
local atan,atan2=math.atan,math.atan2
37
local acos=math.acos
38
39
local function toAxisAngleFromVector(v)
40
	local z=v.z
41
	return z*z<0.99999 and v3(v.y,-v.x,0).unit*acos(-z) or v3()
42
end
43
44
local function AxisAngleLookOrientation(c,v,t)--CFrame,Vector,Tween
45
	local c=c-c.p
46
	local rv=(inverse(c)*v).unit
47
	local rz=rv.z
48
	return rz*rz<0.99999 and c*fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or c
49
end
50
51
local function AxisAngleLookNew(v,t)--CFrame,Vector,Tween
52
	local rv=v.unit
53
	local rz=rv.z
54
	return rz*rz<0.99999 and fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or cf()
55
end
56
57
local function AxisAngleLook(c,v,t)--CFrame,Vector,Tween
58
	local rv=(inverse(c)*v).unit
59
	local rz=rv.z
60
	return rz*rz<0.99999 and c*fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or c
61
end
62
gamma = 0
63
64
65
66
local Sensitivity=0.005
67
68
69
local CameraDirection=Vector3.new(0,0,1)
70
71
local function EulerAnglesYX(l)
72
	local x,z=l.x,l.z
73
	return atan(l.y/(x*x+z*z)^0.5),-atan2(x,-z)
74
end
75
76
local function AnglesXY(l)
77
	local z=l.z
78
	return atan2(l.y,-z),-atan2(l.x,-z)
79
end
80
81
plr = game:service'Players'.LocalPlayer
82
char = plr.Character
83
Mouse2 = plr:GetMouse()      
84
85
Mouse2.KeyDown:connect(function(KeyDown)
86
if KeyDown == "z" then
87
		if Zoom == 8 then return
88
		else
89
		Camera.FieldOfView=10
90
		local Sensitivity=0.0000005
91
		local DirectionBound=3.14159/6
92
		end
93
end
94
end)
95
96
Mouse2.KeyUp:connect(function(KeyUp)
97
if KeyUp == "z" then
98
		Camera.FieldOfView=80
99
		local Sensitivity=0.005
100
		local DirectionBound=3.14159/3
101
end
102
end)
103
104
Mouse2.KeyDown:connect(function(KeyDown)
105
if string.byte(KeyDown) == 50 then
106
		InputService.MouseBehavior=Enum.MouseBehavior.Default
107
end
108
end)
109
110
Mouse2.KeyUp:connect(function(KeyUp)
111
if string.byte(KeyUp) == 50 then
112
		InputService.MouseBehavior=Enum.MouseBehavior.LockCenter
113
end
114
end)
115
116
local function MouseMoved(Input)
117
	if Input.UserInputType==Enum.UserInputType.MouseMovement then
118
		local dx,dy=Input.Delta.x*Sensitivity,Input.Delta.y*Sensitivity
119
		local m2=dx*dx+dy*dy
120
		if m2>0 then
121
			CameraDirection=(AxisAngleLookOrientation(RootPart.CFrame,CameraDirection)*fromAxisAngle(v3(-dy,-dx,0),m2^0.5)).lookVector
122
		end
123
		local RootOrientation=RootPart.CFrame-RootPart.Position
124
		local RelativeDirection=RootOrientation:inverse()*CameraDirection
125
		local AngX,AngY=AnglesXY(RelativeDirection)--RootOrientation:inverse()*
126
		if AngX<-1.57*11/12 then
127
			local y,z,c,s=RelativeDirection.y,RelativeDirection.z,math.cos(-1.57*11/12-AngX),-math.sin(-1.57*11/12-AngX)
128
			z,y=z*c-y*s,z*s+y*c
129
			CameraDirection=RootOrientation*v3(RelativeDirection.x<0 and -(1-y*y-z*z)^0.5 or (1-y*y-z*z)^0.5,y,z)
130
		elseif AngX>1.57*11/12 then
131
			local y,z,c,s=RelativeDirection.y,RelativeDirection.z,math.cos(1.57*11/12-AngX),-math.sin(1.57*11/12-AngX)
132
			z,y=z*c-y*s,z*s+y*c
133
			CameraDirection=RootOrientation*v3(RelativeDirection.x<0 and -(1-y*y-z*z)^0.5 or (1-y*y-z*z)^0.5,y,z)
134
		end
135
	end
136
end
137
138
local Mouse=Player:GetMouse()
139
140
local Zoom=-0.5
141
142
Mouse.KeyDown:connect(function(k) 
143
	if k=="j" then 	
144-
		Camera.CoordinateFrame=PreCam*CFrame.new(0,0,(Position-PreCam.p).magnitude)
144+
145
local d = game.Players.LocalPlayer.Character:GetChildren() 
146
for i=1, #d do 
147
	if (d[i].className == "Accessory") then 
148
		d[i].Handle.LocalTransparencyModifier = 1 
149
	end 
150
end
151
Zoom=-0.5
152
	elseif k=="l" then
153
local d = game.Players.LocalPlayer.Character:GetChildren() 
154
for i=1, #d do 
155
	if (d[i].className == "Accessory") then 
156-
game.Workspace.Memo1332.EpicWings.Handle.LocalTransparencyModifier = 0
156+
		d[i].Handle.LocalTransparencyModifier = 0 
157
	end 
158
end
159
		Zoom=8
160
	end
161
end)
162
163
InputService.InputChanged:connect(MouseMoved)
164
165
Neck.C1=cf()
166
167-
plr.Character.parted.ChildRemoved:connect(function(partedoof)
167+
168-
if partedoof then
168+
169
local CurrentAngY=0
170
171
local function CameraUpdate()
172
	Camera.CameraType="Scriptable"
173
	local cx,cz=CameraDirection.x,CameraDirection.z
174
	local rvx,rvz=RootPart.Velocity.x,RootPart.Velocity.z
175
	if rvx*rvx+rvz*rvz>4 and cx*rvx+cz*rvz<-0.5*(cx*cx+cz*cz)^0.5*(rvx*rvx+rvz*rvz)^0.5 then
176
		DirectionBound=math.min(DirectionBound*0.9,math.abs(CurrentAngY*0.9))
177
	else
178
		DirectionBound=DirectionBound*0.1+3.14159/3*0.9
179
	end
180
	local AngX,AngY=EulerAnglesYX((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection)
181
	if AngY>DirectionBound then
182
		RootPart.CFrame=RootPart.CFrame*CFrame.Angles(0,AngY-DirectionBound,0)
183
	elseif AngY<-DirectionBound then
184
		RootPart.CFrame=RootPart.CFrame*CFrame.Angles(0,AngY+DirectionBound,0)
185
	end
186
	_,CurrentAngY=EulerAnglesYX((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection)
187
	local CameraOrientation=AxisAngleLookNew((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection,1)
188
	Neck.C0=CFrame.new(0,1,0)*CameraOrientation*CFrame.new(0,0.5,0)
189
	local PreCam=AxisAngleLook(RootPart.CFrame*cf(0,1,0),RootPart.CFrame*v3(0,1,0)+CameraDirection)*CFrame.new(0,0.825,0)
190
	if Zoom==8 then
191
		local Part,Position=Workspace:findPartOnRay(Ray.new(PreCam.p,PreCam.lookVector*-8),Character)
192
		Camera.CoordinateFrame=PreCam*CFrame.new(Zoom/2.2,.5,(Position-PreCam.p).magnitude)
193
		else
194
		Camera.CoordinateFrame=PreCam*CFrame.new(0,0,Zoom)
195
		end
196
end
197
198
local d = game.Players.LocalPlayer.Character:GetChildren() 
199
for i=1, #d do 
200
	if (d[i].className == "Accessory") then 
201
		d[i].Handle.LocalTransparencyModifier = 1 
202
	end 
203
end
204
local plr = game.Players.LocalPlayer
205
plr.Changed:connect(function(change)
206
if (change == "Character.parted") then
207
plr.CameraMode = "Classic"
208
script.Disabled = true	
209
script:Destroy()
210
end
211
end)
212
213
214
215
game:GetService("RunService").RenderStepped:connect(CameraUpdate)