Skip to content

Commit a7ebbc0

Browse files
linbingquanRuthySheffi
authored andcommitted
Examples: Add resize event for physics_rapier_instancing.html (mrdoob#31012)
1 parent 9e9a8b7 commit a7ebbc0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

examples/physics_rapier_instancing.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@
156156

157157
}, 1000 / 60 );
158158

159+
window.addEventListener( 'resize', onWindowResize );
160+
161+
}
162+
163+
function onWindowResize() {
164+
165+
camera.aspect = window.innerWidth / window.innerHeight;
166+
167+
camera.updateProjectionMatrix();
168+
169+
renderer.setSize( window.innerWidth, window.innerHeight );
170+
159171
}
160172

161173
function animate() {

0 commit comments

Comments
 (0)