DiV

Members
  • Content count

    2
  • Joined

  • Last visited

  1. intersectsMesh not working?

    I think I found the solution. It attaches a box to my camera. May not be the best way to code it but it works, which is enough for me. Thank you! var portal = BABYLON.Mesh.CreatePlane("portal", 20, scene); portal.position = new BABYLON.Vector3(0, -5, -30); portal.rotation = new BABYLON.Vector3(0, 3.14, 0); let collider = BABYLON.MeshBuilder.CreateBox("collider", {size: 3}, scene); collider.parent = camera; collider.actionManager = new BABYLON.ActionManager(scene); let action = new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: { mesh: portal } }, (evt) => { window.open("https://vk.com","_self"); } ); collider.actionManager.registerAction(action);
  2. Hello, I'm sorry for the stupid question, but how do I detect an intersection? I followed the playground example, but it doesn't work for me. Here is the code: var portal = BABYLON.Mesh.CreateBox("portal", 20, scene); portal.position = new BABYLON.Vector3(0, -5, -30); portal.rotation = new BABYLON.Vector3(0, 3.14, 0); portal.showBoundingBox = true if (ellipsoid.intersectsMesh(portal, false)) { //ellipsoid attached to the camera alert("!!!"); //Message never appears }