Przeglądaj źródła

Merge branch 'master' into TeleportationNoTouch

David Catuhe 5 lat temu
rodzic
commit
9cee07b720

+ 1 - 1
Tools/Gulp/tasks/gulpTasks-libraries.js

@@ -84,7 +84,7 @@ var buildExternalLibrariesMultiEntry = function(libraries, settings, isMin) {
     }
 
     // Generate minified file.
-    let wpBuild = webpackStream(wpConfig, webpack);
+    let wpBuild = webpackStream({ config: wpConfig }, webpack);
     return wpBuild.pipe(gulp.dest(outputDirectory));
 }
 

+ 1 - 1
Tools/Gulp/tasks/gulpTasks-viewerLibraries.js

@@ -27,7 +27,7 @@ var buildViewerLibrary = function (library, settings, out) {
         wpConfig.mode = "development";
     }
 
-    let wpBuild = webpackStream(wpConfig, webpack);
+    let wpBuild = webpackStream({ config: wpConfig }, webpack);
 
     //shoud dtsBundle create the declaration?
     if (settings.build.dtsBundle) {

+ 1 - 0
dist/preview release/what's new.md

@@ -77,6 +77,7 @@
 - Added support for teleportation using pointer events ([RaananW](https://github.com/RaananW))
 - AR reference space type recommendation changed to 'unbounded' ([#7959](https://github.com/BabylonJS/Babylon.js/issues/7959)) ([RaananW](https://github.com/RaananW))
 - Teleportation plugin doesn't use the touched to finish teleportation ([#7916](https://github.com/BabylonJS/Babylon.js/issues/7916)) ([RaananW](https://github.com/RaananW))
+- Support for pointer selection and teleportation in right handed systems ([#7967](https://github.com/BabylonJS/Babylon.js/issues/7967)) ([RaananW](https://github.com/RaananW))
 
 ### Collisions
 

+ 6 - 4
src/Maths/math.vector.ts

@@ -1435,17 +1435,19 @@ export class Vector3 {
     }
     /**
      * Returns a new Vector3 set to (0.0, 0.0, 1.0)
+     * @param rightHandedSystem is the scene right-handed (negative z)
      * @returns a new forward Vector3
      */
-    public static Forward(): Vector3 {
-        return new Vector3(0.0, 0.0, 1.0);
+    public static Forward(rightHandedSystem: boolean = false): Vector3 {
+        return new Vector3(0.0, 0.0, (rightHandedSystem ? -1.0 : 1.0));
     }
     /**
      * Returns a new Vector3 set to (0.0, 0.0, -1.0)
+     * @param rightHandedSystem is the scene right-handed (negative-z)
      * @returns a new forward Vector3
      */
-    public static Backward(): Vector3 {
-        return new Vector3(0.0, 0.0, -1.0);
+    public static Backward(rightHandedSystem: boolean = false): Vector3 {
+        return new Vector3(0.0, 0.0, (rightHandedSystem ? 1.0 : -1.0));
     }
     /**
      * Returns a new Vector3 set to (1.0, 0.0, 0.0)

+ 1 - 1
src/XR/features/WebXRControllerTeleportation.ts

@@ -460,7 +460,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
                                 if (!controllerData.teleportationState.backwards) {
                                     controllerData.teleportationState.backwards = true;
                                     // teleport backwards ONCE
-                                    this._tmpVector.set(0, 0, this.backwardsTeleportationDistance!);
+                                    this._tmpVector.set(0, 0, this.backwardsTeleportationDistance * (this._xrSessionManager.scene.useRightHandedSystem ? -1.0 : 1.0));
                                     this._tmpVector.rotateByQuaternionToRef(this._options.xrInput.xrCamera.rotationQuaternion!, this._tmpVector);
                                     this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);
                                     this._options.xrInput.xrCamera.position.subtractToRef(this._tmpVector, this._tmpVector);

+ 1 - 1
src/XR/webXRInputSource.ts

@@ -141,7 +141,7 @@ export class WebXRInputSource {
         const object = gripIfAvailable && this.grip ? this.grip : this.pointer;
         let worldMatrix = object.computeWorldMatrix();
         worldMatrix.decompose(undefined, this._tmpQuaternion, undefined);
-        this._tmpVector.set(0, 0, 1);
+        this._tmpVector.set(0, 0, (this._scene.useRightHandedSystem ? -1.0 : 1.0));
         this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);
         result.origin.copyFrom(object.absolutePosition);
         result.direction.copyFrom(this._tmpVector);