#How to set Camera farClipPlane or far at runtime?

1 messages · Page 1 of 1 (latest)

wheat pike
#

Tried using this.cam?.farClipPlane = 100; in a copy of orbitcam, I get ERROR: Invalid assignment target

#

Removed the '?' but changing the far clip plane doesn't seem to do anything at runtime in local server?

#

This object is over 900m long and setting the perspective camera far to 0.5 and near to 0.001 at runtime doesn't change the far clipping

#

How to set Camera farClipPlane or far at runtime?

wheat pike
#

No luck with this either as I just wondered if the OrbitControls was using its own local cam, what am I doing wrong here?

        //@ts-ignore
        const perspCam = this.context.mainCamera as THREE.PerspectiveCamera;
        perspCam.near = 0.0165;
        perspCam.far = 0.69;
        //perspCam.far = this.maxZoom + 100;
        console.log(perspCam);
young eagle
wheat pike
#

@young eagle I used that, tried setting it to 1, makes no difference in the local server? Only thing that has any impact is me setting it on the Camera component in Unity then saving before I hit play but I can't change it at runtime

#

Also tried this, no luck

        //@ts-ignore
        this.cam.farClipPlane = 1;
#

In the end, this was what worked: //@ts-ignore this.context.mainCameraComponent.farClipPlane = 0.5;