Hi. How do I access the camera viewport width in code?
I tried:
this.cameraEntity.camera.viewport[2]=0;
and
this.cameraEntity.camera.viewport.width=0;
but neither of those worked
Any ideas?
Hi. How do I access the camera viewport width in code?
I tried:
this.cameraEntity.camera.viewport[2]=0;
and
this.cameraEntity.camera.viewport.width=0;
but neither of those worked
Any ideas?
Hi @Grimmy,
Itβs a pc.Vec4, and the property name is rect:
Try this:
const rectWidth = this.cameraEntity.rect.z;
https://developer.playcanvas.com/en/api/pc.CameraComponent.html#rect
Perfect. Thanks!