Currently, I am using Three.JS
and facing an issue with adjusting the cube to fit the window size perfectly. The challenge is that the cube needs to maintain aspect ratio relative to the window (window.innerWidth
and window.innerHeight
), while also adjusting its Z position based on the display ratio.
cube = new THREE.Mesh( new THREE.CubeGeometry( windowWidth, windowHeight, 200, 6, 6, 6, materials ), new THREE.MeshFaceMaterial() );
cube.position.y = ???;
cube.position.z = ???;
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
renderer.setSize( window.innerWidth, window.innerHeight );
camera.updateProjectionMatrix();
cube.position.y = ???;
cube.position.z = ???;
}
I would appreciate any suggestions or solutions you may have in mind for this issue. Thank you!