@@ -50,6 +50,8 @@ export class TransformNode extends Node {
50
50
private static _TmpRotation = Quaternion . Zero ( ) ;
51
51
private static _TmpScaling = Vector3 . Zero ( ) ;
52
52
private static _TmpTranslation = Vector3 . Zero ( ) ;
53
+ // eslint-disable-next-line @typescript-eslint/naming-convention
54
+ private static _TmpRHRestore = Matrix . Scaling ( 1 , 1 , - 1 ) ;
53
55
54
56
private _forward = new Vector3 ( 0 , 0 , 1 ) ;
55
57
private _up = new Vector3 ( 0 , 1 , 0 ) ;
@@ -1206,9 +1208,16 @@ export class TransformNode extends Node {
1206
1208
const storedTranslation = TmpVectors . Vector3 [ 0 ] ;
1207
1209
this . _worldMatrix . getTranslationToRef ( storedTranslation ) ; // Save translation
1208
1210
1209
- // Cancel camera rotation
1211
+ // Get camera view matrix
1210
1212
TmpVectors . Matrix [ 1 ] . copyFrom ( camera . getViewMatrix ( ) ) ;
1211
1213
1214
+ if ( this . getScene ( ) . useRightHandedSystem ) {
1215
+ // This operation is necessary to cancel out the scaling component of the matrix without decomposing it.
1216
+ // It's a trick to extract only the rotation part.
1217
+ TmpVectors . Matrix [ 1 ] . multiplyToRef ( TransformNode . _TmpRHRestore , TmpVectors . Matrix [ 1 ] ) ;
1218
+ }
1219
+
1220
+ // This will cancel the camera rotation
1212
1221
TmpVectors . Matrix [ 1 ] . setTranslationFromFloats ( 0 , 0 , 0 ) ;
1213
1222
TmpVectors . Matrix [ 1 ] . invertToRef ( TmpVectors . Matrix [ 0 ] ) ;
1214
1223
@@ -1238,7 +1247,7 @@ export class TransformNode extends Node {
1238
1247
this . _worldMatrix . setTranslation ( TmpVectors . Vector3 [ 0 ] ) ;
1239
1248
}
1240
1249
// Billboarding based on camera position
1241
- else if ( cache . useBillboardPosition ) {
1250
+ else {
1242
1251
const storedTranslation = TmpVectors . Vector3 [ 0 ] ;
1243
1252
// Save translation
1244
1253
this . _worldMatrix . getTranslationToRef ( storedTranslation ) ;
0 commit comments