Преглед изворни кода

Examples: Add resize event for `physics_rapier_instancing.html` (#31012)

林炳权 пре 1 година
родитељ
комит
68c274e984
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      examples/physics_rapier_instancing.html

+ 12 - 0
examples/physics_rapier_instancing.html

@@ -156,6 +156,18 @@
 
 				}, 1000 / 60 );
 
+				window.addEventListener( 'resize', onWindowResize );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function animate() {

粤ICP备19079148号