Browse Source

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

林炳权 10 months ago
parent
commit
68c274e984
1 changed files with 12 additions and 0 deletions
  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号