@@ -445,7 +445,7 @@ export class ARRenderer extends EventDispatcher<
445445 const intersection =
446446 this . placementBox ! . controllerIntersection ( scene , controller ) ;
447447 if ( intersection != null ) {
448- const bbox = new Box3 ( ) . setFromObject ( scene . pivot ) ;
448+ const bbox = new Box3 ( ) . setFromObject ( scene . scenePivot ) ;
449449 const footprintY = bbox . min . y +
450450 FOOTPRINT__INTERSECT_THRESHOLD ; // Small threshold above base
451451
@@ -456,11 +456,11 @@ export class ARRenderer extends EventDispatcher<
456456 this . selectedXRController . userData . line . visible = false ;
457457 if ( scene . canScale && this . isWorldSpaceReady ( ) ) {
458458 this . isTwoHandInteraction = true ;
459- this . firstRatio = this . controllerSeparation ( ) / scene . pivot . scale . x ;
459+ this . firstRatio = this . controllerSeparation ( ) / scene . scenePivot . scale . x ;
460460 this . scaleLine . visible = true ;
461461 }
462462 } else {
463- controller . attach ( scene . pivot ) ;
463+ controller . attach ( scene . scenePivot ) ;
464464 }
465465 this . selectedXRController = controller ;
466466 scene . setShadowIntensity ( 0.01 ) ;
@@ -475,7 +475,7 @@ export class ARRenderer extends EventDispatcher<
475475 this . xrController2 ?. userData . isSelected ) {
476476 if ( scene . canScale && this . isWorldSpaceReady ( ) ) {
477477 this . isTwoHandInteraction = true ;
478- this . firstRatio = this . controllerSeparation ( ) / scene . pivot . scale . x ;
478+ this . firstRatio = this . controllerSeparation ( ) / scene . scenePivot . scale . x ;
479479 this . scaleLine . visible = true ;
480480 }
481481 } else {
@@ -510,16 +510,16 @@ export class ARRenderer extends EventDispatcher<
510510 }
511511 const scene = this . presentedScene ! ;
512512 // drop on floor
513- scene . attach ( scene . pivot ) ;
513+ scene . attach ( scene . scenePivot ) ;
514514 this . selectedXRController = null ;
515515 this . goalYaw = Math . atan2 (
516- scene . pivot . matrix . elements [ 8 ] , scene . pivot . matrix . elements [ 10 ] ) ;
517- this . goalPosition . x = scene . pivot . position . x ;
518- this . goalPosition . z = scene . pivot . position . z ;
516+ scene . scenePivot . matrix . elements [ 8 ] , scene . scenePivot . matrix . elements [ 10 ] ) ;
517+ this . goalPosition . x = scene . scenePivot . position . x ;
518+ this . goalPosition . z = scene . scenePivot . position . z ;
519519
520520 // For world-space mode after initial placement, preserve Y position
521521 if ( this . isWorldSpaceReady ( ) ) {
522- this . goalPosition . y = scene . pivot . position . y ;
522+ this . goalPosition . y = scene . scenePivot . position . y ;
523523 }
524524
525525 const menuPanel = this . menuPanel ;
@@ -632,10 +632,10 @@ export class ARRenderer extends EventDispatcher<
632632 this . menuPanel = null ;
633633 }
634634
635- scene . add ( scene . pivot ) ;
636- scene . pivot . quaternion . set ( 0 , 0 , 0 , 1 ) ;
637- scene . pivot . position . set ( 0 , 0 , 0 ) ;
638- scene . pivot . scale . set ( 1 , 1 , 1 ) ;
635+ scene . add ( scene . scenePivot ) ;
636+ scene . scenePivot . quaternion . set ( 0 , 0 , 0 , 1 ) ;
637+ scene . scenePivot . position . set ( 0 , 0 , 0 ) ;
638+ scene . scenePivot . scale . set ( 1 , 1 , 1 ) ;
639639 scene . setShadowOffset ( 0 ) ;
640640 const yaw = this . turntableRotation ;
641641 if ( yaw != null ) {
@@ -753,8 +753,8 @@ export class ARRenderer extends EventDispatcher<
753753
754754 private placeInitially ( ) {
755755 const scene = this . presentedScene ! ;
756- const { pivot , element} = scene ;
757- const { position} = pivot ;
756+ const { scenePivot , element} = scene ;
757+ const { position} = scenePivot ;
758758 const xrCamera = scene . getCamera ( ) ;
759759
760760 const { width, height} = this . overlay ! . getBoundingClientRect ( ) ;
@@ -786,7 +786,7 @@ export class ARRenderer extends EventDispatcher<
786786
787787 // Set initial position and scale immediately for world-space
788788 position . copy ( optimalPosition ) ;
789- pivot . scale . set ( optimalScale , optimalScale , optimalScale ) ;
789+ scenePivot . scale . set ( optimalScale , optimalScale , optimalScale ) ;
790790
791791 // Mark that initial placement is done
792792 this . worldSpaceInitialPlacementDone = true ;
@@ -926,7 +926,7 @@ export class ARRenderer extends EventDispatcher<
926926 const { separation, angle} = this . fingerPolar ( fingers ) ;
927927 this . lastAngle = angle ; // Initialize lastAngle, do not update goalYaw
928928 if ( this . firstRatio === 0 ) {
929- this . firstRatio = separation / scene . pivot . scale . x ;
929+ this . firstRatio = separation / scene . scenePivot . scale . x ;
930930 }
931931 if ( scene . canScale ) {
932932 this . setScale ( separation ) ;
@@ -982,7 +982,7 @@ export class ARRenderer extends EventDispatcher<
982982 }
983983 const fingers = frame . getHitTestResultsForTransientInput ( hitSource ) ;
984984 const scene = this . presentedScene ! ;
985- const scale = scene . pivot . scale . x ;
985+ const scale = scene . scenePivot . scale . x ;
986986
987987 // Robust two-finger gesture handling
988988 if ( fingers . length === 2 ) {
@@ -1072,14 +1072,14 @@ export class ARRenderer extends EventDispatcher<
10721072 }
10731073 }
10741074
1075- private applyXRControllerRotation ( controller : XRController , pivot : Object3D ) {
1075+ private applyXRControllerRotation ( controller : XRController , scenePivot : Object3D ) {
10761076 if ( ! controller . userData . turning ) {
10771077 return ;
10781078 }
10791079 const angle = ( controller . position . x - controller . userData . initialX ) *
10801080 ROTATION_SENSIVITY ;
10811081 this . deltaRotation . setFromAxisAngle ( AXIS_Y , angle ) ;
1082- pivot . quaternion . multiplyQuaternions ( this . deltaRotation , pivot . quaternion ) ;
1082+ scenePivot . quaternion . multiplyQuaternions ( this . deltaRotation , scenePivot . quaternion ) ;
10831083 }
10841084
10851085 private handleScalingInXR ( scene : ModelScene , delta : number ) {
@@ -1095,20 +1095,20 @@ export class ARRenderer extends EventDispatcher<
10951095 this . scaleLine . scale . z = - dist ;
10961096 this . scaleLine . lookAt ( this . xrController2 . position ) ;
10971097 }
1098- const oldScale = scene . pivot . scale . x ;
1098+ const oldScale = scene . scenePivot . scale . x ;
10991099 if ( this . goalScale !== oldScale ) {
11001100 const newScale =
11011101 this . scaleDamper . update ( oldScale , this . goalScale , delta , 1 ) ;
1102- scene . pivot . scale . set ( newScale , newScale , newScale ) ;
1102+ scene . scenePivot . scale . set ( newScale , newScale , newScale ) ;
11031103 }
11041104 }
11051105
11061106 private updatePivotPosition ( scene : ModelScene , delta : number ) {
1107- const { pivot } = scene ;
1107+ const { scenePivot } = scene ;
11081108 const box = this . placementBox ! ;
11091109 const boundingRadius = scene . boundingSphere . radius ;
11101110 const goal = this . goalPosition ;
1111- const position = pivot . position ;
1111+ const position = scenePivot . position ;
11121112
11131113 let source = ChangeSource . NONE ;
11141114 if ( ! goal . equals ( position ) ) {
@@ -1122,7 +1122,7 @@ export class ARRenderer extends EventDispatcher<
11221122 if ( this . xrMode === XRMode . SCREEN_SPACE && ! this . isTranslating ) {
11231123 const offset = goal . y - y ;
11241124 if ( this . placementComplete && this . placeOnWall === false ) {
1125- box . offsetHeight = offset / scene . pivot . scale . x ;
1125+ box . offsetHeight = offset / scene . scenePivot . scale . x ;
11261126 scene . setShadowOffset ( offset ) ;
11271127 } else if ( offset === 0 ) {
11281128 this . placementComplete = true ;
@@ -1146,10 +1146,10 @@ export class ARRenderer extends EventDispatcher<
11461146 // placement
11471147 if ( this . xrMode === XRMode . WORLD_SPACE &&
11481148 ! this . worldSpaceInitialPlacementDone &&
1149- this . goalScale !== pivot . scale . x ) {
1149+ this . goalScale !== scenePivot . scale . x ) {
11501150 const newScale =
1151- this . scaleDamper . update ( pivot . scale . x , this . goalScale , delta , 1 ) ;
1152- pivot . scale . set ( newScale , newScale , newScale ) ;
1151+ this . scaleDamper . update ( scenePivot . scale . x , this . goalScale , delta , 1 ) ;
1152+ scenePivot . scale . set ( newScale , newScale , newScale ) ;
11531153 }
11541154
11551155 scene . updateTarget ( delta ) ;
@@ -1161,9 +1161,9 @@ export class ARRenderer extends EventDispatcher<
11611161 private updateYaw ( scene : ModelScene , delta : number ) {
11621162 // yaw must be updated last, since this also updates the shadow position.
11631163 quaternion . setFromAxisAngle ( vector3 . set ( 0 , 1 , 0 ) , this . goalYaw ) ;
1164- const angle = scene . pivot . quaternion . angleTo ( quaternion ) ;
1164+ const angle = scene . scenePivot . quaternion . angleTo ( quaternion ) ;
11651165 const angleStep = angle - this . yawDamper . update ( angle , 0 , delta , Math . PI ) ;
1166- scene . pivot . quaternion . rotateTowards ( quaternion , angleStep ) ;
1166+ scene . scenePivot . quaternion . rotateTowards ( quaternion , angleStep ) ;
11671167 }
11681168
11691169 private updateMenuPanel ( scene : ModelScene , box : PlacementBox , delta : number ) {
@@ -1175,15 +1175,15 @@ export class ARRenderer extends EventDispatcher<
11751175
11761176 private applyXRInputToScene ( delta : number ) {
11771177 const scene = this . presentedScene ! ;
1178- const pivot = scene . pivot ;
1178+ const scenePivot = scene . scenePivot ;
11791179 const box = this . placementBox ! ;
11801180
11811181 this . updatePlacementBoxOpacity ( box , delta ) ;
11821182 this . updateTwoHandInteractionState ( ) ;
1183- this . applyXRControllerRotations ( pivot ) ;
1183+ this . applyXRControllerRotations ( scenePivot ) ;
11841184 this . handleScalingInXR ( scene , delta ) ;
11851185
1186- if ( pivot . parent !== scene ) {
1186+ if ( scenePivot . parent !== scene ) {
11871187 // attached to controller instead
11881188 // when moving the model, the menu panel should disapear
11891189 this . updateMenuPanel ( scene , box , delta ) ;
@@ -1217,12 +1217,12 @@ export class ARRenderer extends EventDispatcher<
12171217 this . isTwoHandInteraction = ! ! bothSelected ;
12181218 }
12191219
1220- private applyXRControllerRotations ( pivot : Object3D ) {
1220+ private applyXRControllerRotations ( scenePivot : Object3D ) {
12211221 if ( ! this . isTwoHandInteraction ) {
12221222 if ( this . xrController1 )
1223- this . applyXRControllerRotation ( this . xrController1 , pivot ) ;
1223+ this . applyXRControllerRotation ( this . xrController1 , scenePivot ) ;
12241224 if ( this . xrController2 )
1225- this . applyXRControllerRotation ( this . xrController2 , pivot ) ;
1225+ this . applyXRControllerRotation ( this . xrController2 , scenePivot ) ;
12261226 }
12271227 }
12281228
0 commit comments