Use mouse without 90 degree limit

I’m looking for a way to control a 3D space craft using the mouse. I’m running into an issue where if you keep moving the mouse up or down, you’ll stop pitching at -90 or 90 degrees. Is there a way to use the mouse in the same soft of fashion without hitting a limit straight up or down?

It’s actually 89.
There’s a convar for it, cl_pitchdown/up but requires cheats. But it’s also clamped serverside(i.e. not really) cough azui

Hmmm… poo. Any way around it?

You’re probably going to have to do something like:

local delta = pl:EyeAngles( )
pl:SetEyeAngles( angle_zero )

pl:GetShip( ):SetAngles( pl:GetShip( ):Angle( ) + delta )

Where angle_zero is of course Angle( 0, 0, 0 ).

Then, you just adjust the spaceship’s rotation based on delta and use CalcView to make the player think they are aiming the correct way. The goal is to find out how much the player’s view has moved in a frame.

That wouldn’t work. And regardless, it would spam the console because of azuis little server limiting thingy(it only limits what it sends back, you can still do things like shoot from behind you.)
A solution would be parenting the player to a prop and moving that prop.

Why wouldn’t an approach like mine work?
And why would it spam the console with any amount of errors?

The player’s view would be locked to a valid angle and another entity is the one being rotated.

Kogitsue’s theory sounds solid. I was thinking something along the same lines but he’s summed it up in a nice piece of code.

What’s this doo-dad that will spit out console errors?

Considering he made no mention of :GetShip, I just thought.
Plus you should gradually move, not just instantly move it.

You could be an OH GOD OH NO CHEATER BAN HIM and go download cvar3 and force the value.

it’s still going to be clamped. When the player looks fully upwards or downwards they won’t be able to continue rotating and thus there will be no detectable angle change.

What you should do is check the difference between your eyeangles and what they were last frame, then set your eyeangles back to what they were last frame and repeat. For example :


local oldAngles = Angle(0,0,0);

// ENT is the space ship entity
funtion ENT:Think()

// self.Owner is the owner of the spaceship
self:SetAngles( self:GetAngles() + math.AngleDifference(self.Owner:EyeAngles(), oldAngles) )

self.Owner:SetEyeAngle( oldAngles );
oldAngles = self.Owner:GetEyeAngles()


I was assuming the OP was trying to rotate the ship in a think or similar event. There’s absolutely no point in doing a delta if you aren’t resetting the view anyways.