I found a crouch script on this forum, but you have you press C to toggle it on and off. If I could get a way to make it non-toggle, that would be good. I set the script to use Control though.
if window:KeyHit(Key.ControlKey) then
crouched = not crouched
end
self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , crouched, 1.0, 0.5, true)
if self.entity:GetCrouched() then
self.camera:SetPosition(self.entity:GetPosition()+Vec3(0,1,0))
else
self.camera:SetPosition(self.entity:GetPosition()+Vec3(0,2,0))
end
-- Needs to be KeyDown instead of KeyHit. I figured it out.