|
@@ -21,6 +21,7 @@ import { PickingInfo } from '../../../Collisions/pickingInfo';
|
|
import { Curve3 } from '../../../Maths/math.path';
|
|
import { Curve3 } from '../../../Maths/math.path';
|
|
import { LinesBuilder } from '../../../Meshes/Builders/linesBuilder';
|
|
import { LinesBuilder } from '../../../Meshes/Builders/linesBuilder';
|
|
import { WebXRAbstractFeature } from './WebXRAbstractFeature';
|
|
import { WebXRAbstractFeature } from './WebXRAbstractFeature';
|
|
|
|
+import { Color3 } from '../../../Maths/math.color';
|
|
|
|
|
|
/**
|
|
/**
|
|
* The options container for the teleportation module
|
|
* The options container for the teleportation module
|
|
@@ -64,6 +65,10 @@ export interface IWebXRTeleportationOptions {
|
|
* Disable the mesh's animation sequence
|
|
* Disable the mesh's animation sequence
|
|
*/
|
|
*/
|
|
disableAnimation?: boolean;
|
|
disableAnimation?: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Disable lighting on the material or the ring and arrow
|
|
|
|
+ */
|
|
|
|
+ disableLighting?: boolean;
|
|
};
|
|
};
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -461,7 +466,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
|
|
let teleportationTarget = GroundBuilder.CreateGround("teleportationTarget", { width: 2, height: 2, subdivisions: 2 }, scene);
|
|
let teleportationTarget = GroundBuilder.CreateGround("teleportationTarget", { width: 2, height: 2, subdivisions: 2 }, scene);
|
|
teleportationTarget.isPickable = false;
|
|
teleportationTarget.isPickable = false;
|
|
let length = 512;
|
|
let length = 512;
|
|
- let dynamicTexture = new DynamicTexture("DynamicTexture", length, scene, true);
|
|
|
|
|
|
+ let dynamicTexture = new DynamicTexture("teleportationPlaneDynamicTexture", length, scene, true);
|
|
dynamicTexture.hasAlpha = true;
|
|
dynamicTexture.hasAlpha = true;
|
|
let context = dynamicTexture.getContext();
|
|
let context = dynamicTexture.getContext();
|
|
let centerX = length / 2;
|
|
let centerX = length / 2;
|
|
@@ -476,7 +481,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
|
|
context.stroke();
|
|
context.stroke();
|
|
context.closePath();
|
|
context.closePath();
|
|
dynamicTexture.update();
|
|
dynamicTexture.update();
|
|
- let teleportationCircleMaterial = new StandardMaterial("TextPlaneMaterial", scene);
|
|
|
|
|
|
+ const teleportationCircleMaterial = new StandardMaterial("teleportationPlaneMaterial", scene);
|
|
teleportationCircleMaterial.diffuseTexture = dynamicTexture;
|
|
teleportationCircleMaterial.diffuseTexture = dynamicTexture;
|
|
teleportationTarget.material = teleportationCircleMaterial;
|
|
teleportationTarget.material = teleportationCircleMaterial;
|
|
let torus = TorusBuilder.CreateTorus("torusTeleportation", {
|
|
let torus = TorusBuilder.CreateTorus("torusTeleportation", {
|
|
@@ -522,6 +527,14 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
|
|
if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {
|
|
if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {
|
|
torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
|
|
torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
|
|
cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
|
|
cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
|
|
|
|
+ } else {
|
|
|
|
+ const torusConeMaterial = new StandardMaterial("torusConsMat", scene);
|
|
|
|
+ torusConeMaterial.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting;
|
|
|
|
+ if (torusConeMaterial.disableLighting) {
|
|
|
|
+ torusConeMaterial.emissiveColor = Color3.Gray();
|
|
|
|
+ }
|
|
|
|
+ torus.material = torusConeMaterial;
|
|
|
|
+ cone.material = torusConeMaterial;
|
|
}
|
|
}
|
|
|
|
|
|
this._options.teleportationTargetMesh = teleportationTarget;
|
|
this._options.teleportationTargetMesh = teleportationTarget;
|