Limiting orbital pan and tilt

Hello Folks,

have gone through most of the examples for limiting Orbital pan ,
could not make this work , it goes beyond the set values ,

pan and tilt limits to -some small value to + small value,

and what id like to do is once the pan is done , get cameras back to the original values (0,0,5),
yes i tried to set this in animate() , but would not adhere to the set values ?

i saw this work in one of the examples cant make this work in my code though,

what am i missing ,

   controls = new OrbitControls( camera, renderer.domElement );
  controls.minPolarAngle = Math.PI * .15; 
  controls.maxPolarAngle = Math.PI * .15;
  controls.panSpeed = .075;
  controls.minAzimuthAngle = Math.PI * .15;
  controls.maxAzimuthAngle = Math.PI * .15;
  controls.enableDamping = true;
  controls.dampingFactor = 0.01;
  controls.minDistance = 5;
  controls.maxDistance = 5;

thanks

your minPolarAngle and maxPolarAngle are the same value
your minAzimuthAngle and maxAzimuthAngle are the same value

Hey Sean,

thanks for noticinig that,
there was a typo when i copy pasted this,
when add

controls.minPolarAngle = 0; 
controls.maxPolarAngle = Math.PI * .5;

it limits the rotation,

its when i start adding limitation to the controls,
like -28 deg to +28 degrees tilt
i might be wrong , i did this ,

controls.minPolarAngle = - Math.PI * 0.16;
controls.maxPolarAngle = Math.PI * 0.16;

it does not work, it keeps going over the limits ,
and i have controls.update(); in the animate function

and so with the

  controls.minAzimuthAngle = - Math.PI *0 .16;
  controls.maxAzimuthAngle = Math.PI * 0.16;

but as soon as i do this , it flips the model 45 deg, while setting the azimuth values

it works there were no problems ,

controls.minAzimuthAngle = - .15;
controls.maxAzimuthAngle = .15;

except for

controls.maxPolarAngle, when i change it lesser than 0.5 , it flips the camera ?