Camera: Prevent setting non-uniform scale#33440
Camera: Prevent setting non-uniform scale#33440WestLangley wants to merge 1 commit intomrdoob:devfrom
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
TBH, since For what use case is setting camera scale now required? |
|
I can't think of a use case right now since normally if a camera is influenced by scaling, it's the scale from the world transform. Could the PR updated so no (local) scaling is allowed? |
It can be, but I was thinking that would be overly-restrictive. /ping @hybridherbst |
|
@Mugen87 As you suggested, I could modify the PR like so, and optionally warn once. Your choice. updateMatrix() {
if ( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {
// console.warnOnce( 'THREE.Camera: .scale is not supported. Use a parent Group (dolly) instead.' );
this.scale.set( 1, 1, 1 );
}
super.updateMatrix();
} |
|
Still thinking about potential side effects of this change. I know from VR that cameras might be part of the scene graph, I think this is also true for Sorry for asking again but what is the motivation behind this change? Is it to get the camera's world matrix back in sync with its inverse? |
No, that will not happen here, since the user can add the camera to a scaled parent. The original motivation was to prevent the user from setting non-uniform scale, since it is officially "not supported." I thought uniform scale was still required in WebXR, but perhaps that is typically handled with a parent camera rig, so this PR could be modified so uniform scaling of the camera is also prevented. |
This PR prevents setting non-uniform scale in cameras.
Currently, this is just a draft for discussion.