How do I put limits on OrbitControl?

前端 未结 3 1133
攒了一身酷
攒了一身酷 2020-12-24 06:24

Is there a way to put limits on the OrbitControls.js? Imagine I\'m creating something above the ground, I wouldn\'t like the camera to go below the ground, know

3条回答
  •  执笔经年
    2020-12-24 07:04

    OrbitControls source

    Zoom in / zoom out

    this.minDistance = 0;
    this.maxDistance = Infinity;
    

    Where to stop rotation :

    this.minPolarAngle = 0; // radians
    this.maxPolarAngle = Math.PI; // radians
    

    Don't let to go below the ground

    controls.maxPolarAngle = Math.PI/2; 
    

提交回复
热议问题