Is there any way to fix this camera movement?

I have this issue that I already made a post for but it got basically no replies.
So whenever I move my camera up or down, it kinda looks wonky and I was wondering if there was a way to fix that (without using viewmodels).

By that I mean when I look up, its very zoomed in and when I look down, it’s very zoomed out

3 Likes

Bump. Need help \\\\\\\\\\

Are you using scripts for such camera movement? If so then you should include your code that handles camera actions and developer will look at that and find out what’s wrong.

1 Like

Nope, the camera movement doesn’t change. Except camera bobble but that wouldn’t affect this.
One thing that deff moves is the arms, they move up an down. Making this camera movement thing

Are you talking about that little stutter there is when you move up and down? Because that’s the only thing I noticed.

Yeah, I’d like for the item to stay more centered. But when you look up, the tool goes almost out of the top of the screen. And when you look down, it goes down to the ground

I mean it’s super difficult to give an answer without you providing a script. Are you sure that the object is relying on the cameras position and orientation or did you accidentally use the players head for that? Like, what’s the reference origin point for it?

1 Like

I’m not sure what it moves referenced too, since I didnt’t write this code really, More found it.
Using C0’s not my strongest ability

wait()
local plr = game.Players.LocalPlayer
local char = plr.Character

if not char or not char.Parent then
	char = plr.CharacterAdded:wait()
end

local torso = char:WaitForChild("Torso")
local camera = game.Workspace.CurrentCamera
local tween = game:GetService("TweenService")

updateSpeed = 0.1

local humanoid = char:WaitForChild("Humanoid")
local rs = torso:WaitForChild("Right Shoulder")
local hrp = char:WaitForChild("HumanoidRootPart")
local ls = torso:WaitForChild("Left Shoulder")

local mouse = plr:GetMouse()

game:GetService("RunService").RenderStepped:Connect(function()
	if not char:FindFirstChildOfClass("Tool") then
		for v7, v8 in pairs(char:GetDescendants()) do
			if v8:IsA("CharacterMesh") and v8.BodyPart == Enum.BodyPart.LeftArm then
				v8.Parent = char;
			end;
		end;
		for v9, v10 in pairs(char:GetDescendants()) do
			if v10:IsA("CharacterMesh") and v10.BodyPart == Enum.BodyPart.RightArm then
				v10.Parent = char;
			end;
		end;
		
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi / 2, 0)
		}):Play();
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi / 2, 0)
		}):Play();
		
		return;
	end;
	
	if char:FindFirstChildOfClass("Tool") then
		local la = char:FindFirstChildOfClass("Tool"):FindFirstChild("LeftArm")
		local ra = char:FindFirstChildOfClass("Tool"):FindFirstChild("RightArm")
		
		if la and ra then
			if la.Value then
				char:FindFirstChild("Left Arm").LocalTransparencyModifier = 0
			else
				char:FindFirstChild("Left Arm").LocalTransparencyModifier = 1
			end
			
			if ra.Value then
				char:FindFirstChild("Right Arm").LocalTransparencyModifier = 0
			else
				char:FindFirstChild("Right Arm").LocalTransparencyModifier = 1
			end
		end
	else
		char:FindFirstChild("Left Arm").LocalTransparencyModifier = 1
		char:FindFirstChild("Right Arm").LocalTransparencyModifier = 1
	end
	
	if rs then
		game:GetService("TweenService"):Create(rs, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(-math.asin((mouse.Origin.Position - mouse.Hit.Position).unit.y), 1.55, 0)
		}):Play()
	end
	if ls then
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(-math.asin((mouse.Origin.Position - mouse.Hit.Position).unit.y), -1.55, 0)
		}):Play()
	end
	for i, v in pairs(char:GetDescendants()) do
		if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.LeftArm then
			v.Parent = char
		end
	end
	for i, v in pairs(char:GetDescendants()) do
		if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.RightArm then
			v.Parent = char
		end
	end
	
	humanoid.CameraOffset = Vector3.new(0, 0, -1)
end)

Still looking for a solution, any ideas people?

Hey. That day I tried, analyzed the shooter that had something like that and came to conclusion that the best way to do this, without offsetting the arms badly is to use viewmodels, sadly.

So I found a solution basically, just need some adjustments but this is the edited version of the code, for anyone who may be in need of this:

wait()
local plr = game.Players.LocalPlayer
local char = plr.Character

if not char or not char.Parent then
	char = plr.CharacterAdded:wait()
end

local torso = char:WaitForChild("Torso")
local camera = game.Workspace.CurrentCamera
local tween = game:GetService("TweenService")

updateSpeed = 0.1

local humanoid = char:WaitForChild("Humanoid")
local rs = torso:WaitForChild("Right Shoulder")
local hrp = char:WaitForChild("HumanoidRootPart")
local head = char:WaitForChild("Head")
local ls = torso:WaitForChild("Left Shoulder")
local neck = torso:WaitForChild("Neck")

local mouse = plr:GetMouse()

local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)

local welds = nil

function UpOrDown(LookVector)
	local LookVector = LookVector.Unit
	local UpVector = Vector3.new(0, 1, 0)

	return LookVector:Dot(UpVector)
end

game:GetService("RunService").RenderStepped:Connect(function()
	if not char:FindFirstChildOfClass("Tool") then
		for v7, v8 in pairs(char:GetDescendants()) do
			if v8:IsA("CharacterMesh") and v8.BodyPart == Enum.BodyPart.LeftArm then
				v8.Parent = char;
			end
		end
		for v9, v10 in pairs(char:GetDescendants()) do
			if v10:IsA("CharacterMesh") and v10.BodyPart == Enum.BodyPart.RightArm then
				v10.Parent = char;
			end
		end
		
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi / 2, 0)
		}):Play()
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi / 2, 0)
		}):Play()
		game:GetService("TweenService"):Create(neck, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
		}):Play()
		
		return
	end
	
	if char:FindFirstChildOfClass("Tool") then
		local la = char:FindFirstChildOfClass("Tool"):FindFirstChild("LeftArm")
		local ra = char:FindFirstChildOfClass("Tool"):FindFirstChild("RightArm")
		
		if la and ra then
			if la.Value then
				char:FindFirstChild("Left Arm").LocalTransparencyModifier = 0
			else
				char:FindFirstChild("Left Arm").LocalTransparencyModifier = 1
			end
			
			if ra.Value then
				char:FindFirstChild("Right Arm").LocalTransparencyModifier = 0
			else
				char:FindFirstChild("Right Arm").LocalTransparencyModifier = 1
			end
		end
	else
		char:FindFirstChild("Left Arm").LocalTransparencyModifier = 1
		char:FindFirstChild("Right Arm").LocalTransparencyModifier = 1
	end
	
	local cameraDot = UpOrDown(head.CFrame.LookVector)
	if rs then
		game:GetService("TweenService"):Create(rs, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(1, 0.5 - cameraDot, 1 * (cameraDot * -1)) * CFrame.Angles(-math.asin((head.Position - mouse.Hit.Position).unit.y), 1.55, 0),
		}):Play()
	end
	if ls then
		game:GetService("TweenService"):Create(ls, TweenInfo.new(updateSpeed), {
			C0 = CFrame.new(-1, 0.5 - cameraDot, 1 * (cameraDot * -1)) * CFrame.Angles(-math.asin((head.Position - mouse.Hit.Position).unit.y), -1.55, 0),
		}):Play()
	end
	
	local Direction = mouse.Hit.p
	local b = head.Position.Y - Direction.Y
	local dist = (head.Position - Direction).Magnitude
	local answer = math.asin(b / dist)
	
	game:GetService("TweenService"):Create(neck, TweenInfo.new(updateSpeed), {
		C0 = orginalC0 * CFrame.fromEulerAnglesXYZ(answer, 0, 0)
	}):Play()
	
	for i, v in pairs(char:GetDescendants()) do
		if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.LeftArm then
			v.Parent = char
		end
	end
	for i, v in pairs(char:GetDescendants()) do
		if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.RightArm then
			v.Parent = char
		end
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.