mbehnaam
mbehnaam

Reputation: 431

How to update CombinedCamera parameters in Three.JS?

I am going to change the Near Clipping Plane parameter and then update camera to see the result.

First I create camera with near clipping plane=10 and then I want to set it to 700. I wrote the following code, but after camera.updateProjectionMatrix(); , it sets to 10 again!!

camera = new THREE.CombinedCamera(window.innerWidth ,window.innerHeight ,40 ,10 ,10000 ,-500 ,100); //near clipping plane is defined 10  
camera.position.set( 1000, 1000, 1000 );
camera.near = 700;   //near =700
camera.updateProjectionMatrix();  //near=10 !!!! whyyyyy!!! 
scene.add( camera );                

Then I used : camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 ); camera.near=700; camera.updateProjectionMatrix();

It resolved!!!

I think there is a bug in "CombinedCamera" when you use camera.updateProjectionMatrix();

Upvotes: 0

Views: 538

Answers (1)

WestLangley
WestLangley

Reputation: 104833

For your CombinedCamera, what you want to do is this:

camera.cameraP.near = 700;
camera.updateProjectionMatrix();

Upvotes: 1

Related Questions