How to Keep THREE.Plane always perpendicular to camera?

I am using THREE.Plane as clipping plane for my object. while rotating the camera , my plane is also rotating . I want to keep my plane always perpendicular to camera , so while rotating the camera , I can see my object clipping also rotating .

I cannot access geometry of THREE.Plane . and there is no lookAt property also in Plane . Can anyone please help me how can I achieve this .

Hi!
Change plane’s normal. Docs
It will be normalized subrtaction of camera position and object position.

maybe using the camera near/far planes will give you the effect you are after
PerspectiveCamera#far – three.js docs (threejs.org)

I thought, the question is about THREE.Plane, not THREE.Mesh of THREE.PlaneGeometry :thinking:

1 Like

@prisoner849 I am doing this now. What’s constant in THREE.Plane parameter. ? is this the distance from origin or distance from camera ?

I am finding normal by substracting obj position and camera position . I calculated obj distance from origin and camera both , and tried as constant parameter . but both are positioning the plane in different location , not in the same obj location .

I would try this method: three.js docs

let n = new THREE.Vector3(); // normal - for re-use
let cpp = new THREE.Vector3(); //coplanar point - for re-use
let plane = new THREE.Plane();

let objPos = object.position;
let camPos = camera.position;
...
// somewhere in animation loop or anywhere else further
n.subVectors(camPos, objPos).normalize();
cpp.copy(objPos);
plane.setFromNormalAndCoplanarPoint(n, cpp);

@prisoner849 This saved my day . Thanks a lot. :pray:

This will make other object in the scene also invisible . I want to apply this clipping only for particular object.