jameskmonger Posted November 30, 2016 Share Posted November 30, 2016 I'm using Babylon.js `2.4.0`. I have a mesh (in the shape of a couch) loaded from a `.obj` file, and a camera set up like this: let camera = new BABYLON.FreeCamera('camera1', new BABYLON.Vector3(0, 2, 0), scene); camera.checkCollisions = true; camera.applyGravity = true; camera.ellipsoid = new BABYLON.Vector3(1, 1, 1); camera.attachControl(canvas, false); camera.speed = 0.5; camera.actionManager = new BABYLON.ActionManager(scene); I want to set up an event so that when I walk through the couch, "intersection" is logged to the console: let action = new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: { mesh: couchMesh }}, (evt) => { console.log("intersection"); } ); this.camera.actionManager.registerAction(action); When I walk through the mesh, nothing is logged to the console. I've created an example on the [Babylon.js Playground](http://www.babylonjs-playground.com/#KNXZF#1) using an example that they provide to check that it wasn't a problem with my mesh or camera set up, and it doesn't appear to be (the playground doesn't work either). Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 3, 2016 Share Posted December 3, 2016 Hiya @jameskmonger, welcome to the forum! Sorry it has taken so long to receive a reply. I don't think cameras can use onIntersectionEnterTrigger... because cameras are not a mesh. I'm not REAL sure about that, but that COULD be the problem. http://www.babylonjs-playground.com/#KNXZF#2 Here, I built a "camera gizmo" mesh, made it invisible, parented it to the camera, and then put the intersect actionManager on the camgizmo. Seems to be working. Perhaps others will have comments or better ideas. Again, welcome, good to have you with us. Eric McG, GameMonetize and Nabroski 2 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.