Jump to content

VRTeleportationOptions


brianzinn
 Share

Recommended Posts

Just a question about floorMeshName.

export interface VRTeleportationOptions {
   floorMeshName?: string; // If you'd like to provide a mesh acting as the floor
   floorMeshes?: Mesh[];
}

I was expecting from that comment a different comparison than (https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/VR/babylon.vrExperienceHelper.ts#L498)

if (this._floorMeshName && mesh.name === this._floorMeshName) {
  return true;
}

Otherwise if you set the floor mesh name to 'ground' and then had another mesh like 'ground-cover' or any mesh 'ground' as a substring would be teleportable.

Link to comment
Share on other sites

If that's the case then assuming the mesh already exists you could do here (https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/VR/babylon.vrExperienceHelper.ts#L511):

if (vrTeleportationOptions) {
  if (vrTeleportationOptions.floorMeshes && Array.isArray(vrTeleportationOptions.floorMeshes)) {
    this._floorMeshesCollection = vrTeleportationOptions.floorMeshes;
  }

  if (vrTeleportationOptions.floorMeshName) {
    let floorMesh = this_scene.getMeshByName(vrTeleportationOptions.floorMeshName);
    if (floorMesh) {
      this.addFloorMesh(floorMesh); // assuming you added a method to add/remove meshes or this._floorMeshesCollection.push(floorMesh)
    }
  }
}


I like highlightLayer addMesh() and removeMesh().  Glad to see the floor mesh collection added, as I have a bunch of teleportable meshes!  I guess I'm just expecting it to work like HighlightLayer/ShadowGenerator to allow changed after enabling teleportation :) I'm happy to do a PR.  Looks incredible in Windows Mixed Reality. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...