Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Head Y Turn limitter, how to do it?

Asked by 8 years ago

Hi, i'm doing a custom first person on Scriptable mode camera

The script is working, but when it reach under -0.87 or above 0.923, the head inverts the turn... it bugs everything

the script:

if mouse.Y < lastY then
                    print(neck.C0.lookVector)
                    neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(neck.C0.lookVector.Y - ((lastY + mouse.Y) / 100) ,math.pi,0)
                    lastY = mouse.Y
                    if (neck.C0.lookVector.Z < -0.87) and (neck.C0.lookVector.Z < -0.800146341) then -- -0.800146341
                        neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(-0.87 ,math.pi,0)
                    end


                end
                if mouse.Y > lastY then
                    print(neck.C0.lookVector)
                    neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(neck.C0.lookVector.Y - ((lastY + mouse.Y) / 100) ,math.pi,0)
                    lastY = mouse.Y
                    if (neck.C0.lookVector.Z > 0.923) and (neck.C0.lookVector.Z > -0.800146341) then
                        neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(0.923 ,math.pi,0)
                    end


                end
0
just have an if statement whether the calculation is under/above either of those two TheDeadlyPanther 2460 — 8y

Answer this question