Skip to content

Commit 69d3689

Browse files
authored
fix grounded skybox rotation (#4752)
1 parent c9b75ba commit 69d3689

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/model-viewer/src/three-components/ModelScene.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ export class ModelScene extends Scene {
616616
x = this.targetDamperX.update(x, goal.x, delta, normalization);
617617
y = this.targetDamperY.update(y, goal.y, delta, normalization);
618618
z = this.targetDamperZ.update(z, goal.z, delta, normalization);
619+
this.groundedSkybox.position.x = -x;
620+
this.groundedSkybox.position.z = -z;
619621
this.target.position.set(x, y, z);
620622
this.target.updateMatrixWorld();
621623
this.queueRender();
@@ -643,6 +645,7 @@ export class ModelScene extends Scene {
643645
*/
644646
set yaw(radiansY: number) {
645647
this.rotation.y = radiansY;
648+
this.groundedSkybox.rotation.y = -radiansY;
646649
this.queueRender();
647650
}
648651

packages/modelviewer.dev/examples/lightingandenv/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h2 class="demo-title">Ground-projected Skybox</h2>
8181
</div>
8282
<example-snippet stamp-to="groundedSkybox" highlight-as="html">
8383
<template>
84-
<model-viewer camera-controls touch-action="pan-y" skybox-image="../../shared-assets/environments/whipple_creek_regional_park_1k_HDR.jpg" skybox-height="1.5m" shadow-intensity="2" max-camera-orbit="auto 90deg auto" alt="A 3D astronaut model depicted within a forest" src="../../shared-assets/models/Astronaut.glb"></model-viewer>
84+
<model-viewer camera-controls touch-action="pan-y" auto-rotate disable-pan skybox-image="../../shared-assets/environments/whipple_creek_regional_park_1k_HDR.jpg" skybox-height="1.5m" shadow-intensity="2" max-camera-orbit="auto 90deg auto" alt="A 3D astronaut model depicted within a forest" src="../../shared-assets/models/Astronaut.glb"></model-viewer>
8585
</template>
8686
</example-snippet>
8787
</div>

0 commit comments

Comments
 (0)