MackeyK24 Posted June 29, 2018 Share Posted June 29, 2018 Hey guys... I never actually used the babylon action manager (or observables) before, i was handling all interactions myself. But i want to setup some kind of metadata so i can configure mesh actions in the Unity Editor Toolkit. But what i think should is not... This is what i thought is a simple click action // Setup pick action sphere.actionManager = new BABYLON.ActionManager(scene); sphere.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnPickTrigger }, function() { console.log("Got Pick Action"); })); But dont get anything if 'Click' on the sphere Please check this playground https://playground.babylonjs.com/#4SH4JZ Quote Link to comment Share on other sites More sharing options...
SinhNQ Posted June 29, 2018 Share Posted June 29, 2018 Fixed: https://playground.babylonjs.com/#4SH4JZ#1 ? brianzinn 1 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 29, 2018 Share Posted June 29, 2018 You were nearly there, but if you don't supply a parameter with your constructor object, then you need to pass a number (BABYLON.ActionManager.OnPickTrigger is a number) as SinhNQ did. Here is your PG with the extra property added to trigger options: https://playground.babylonjs.com/#4SH4JZ#2 You can see here in the super constructor that you need a parameter, even if it's empty: https://github.com/BabylonJS/Babylon.js/blob/master/src/Actions/babylon.action.ts#L37 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted June 29, 2018 Author Share Posted June 29, 2018 Thanks guys... Both of you Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted June 29, 2018 Author Share Posted June 29, 2018 One more question... i assumed @davrous was using a trigger action on the circle mesh in the mansion. His quote: Quote When looking at the circle mesh on top of the door of the mansion, the gaze cursor will change from white to blue and will become bigger. This is to indicate to the user he can launch an action associated to this mesh. To trigger it, simply press the A button of the gamepad while looking at it. Well i tried to setup a mesh and change the material with the onpicktrigger... it does work from the mouse click... but in VR mode it does not.... What is the trigger you are using to trigger the ghost in the window that works with gamepad A button ??? UPDATE I think OnPickUpTrigger works with Mouse Click and Gamepad A button when no controller... Is That Right ??? But not for VR Controller Trigger, how the heck did he set that up ACTION in 3DS Max ??? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 29, 2018 Share Posted June 29, 2018 It's all done in the .babylon file (50MB+): https://www.babylonjs.com/Scenes/Mansion/Mansion.babylon That file crashed my VSCode and took forever to open in Sublime, but I did find some nested actions starting with OnLeftPickTrigger - does that work? Find the action you are after and then you need to generate that. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted June 29, 2018 Author Share Posted June 29, 2018 12 minutes ago, brianzinn said: It's all done in the .babylon file (50MB+): https://www.babylonjs.com/Scenes/Mansion/Mansion.babylon That file crashed my VSCode and took forever to open in Sublime, but I did find some nested actions starting with OnLeftPickTrigger - does that work? Find the action you are after and then you need to generate that. That did it... OnLeftPickTrigger works with Mouse Click, Gamepad A Button And VR Pointer Click Or Trigger Thanks @brianzinn ... Wait til you guys @davrous and @Deltakosh see the support i added to the toolkit for WebVR using Dave's VRExperienceHelper in my SceneManager Things Like: Controller Prefabs... Now you can use a fully scripted up with nested hierarchy component prefab as your Left and Right VR Controllers... Floor Mesh Tags... You can now Unity Tag or Babylon Component Tag your floor meshes including terrains... But even though has been an awesome feature for me by itself, i add built in Unity Tag called 'Navigation' that the Camera Rig defaults to (you can change or add to it of course) . So you can simple tag your floor meshes with that... But wait... even BETTER... Navigation Mesh Teleportation... I tied the Built-in Unity Navigation Mesh Generator to TAG itself as 'Navigation'... So instead of using a bunch of arbitrary meshes as floor meshes... You can bake a Navigation mesh with WALKABLE surfaces. The same Nav Mesh you would use for AI to say what is a walkable surface you can now TELEPORT on... It also prevents you from teleporting INSIDE static meshes because the nav mesh has CUTOUTS of NON-WALKABLE areas... You can also now bake the navmesh to use multiple levels in a building... You basically DRAPE a navigation mesh over your entire scene defining walkable areas to teleport on... i am using it and works perfect... with the ONE single LOW poly mesh DRAPED accros my secene All this again... with NO lines of code, just configure the camera rig.... Unless you need runtime access to the VRExperienceHelper for more complex intereactions... You can easily using the internal scene manager VRExperienceHelper exposed as manager.webvr Coming Soon with the 3.3 Beta davrous 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted June 29, 2018 Author Share Posted June 29, 2018 Yo @davrous i got another issue... While in VR Mode if you double click the mouse it comes out of VR mode as if i the the ESC button. Weird. UPDATE Even this simple VR demo exits VR mode on double click... https://playground.babylonjs.com/#HARNA9#2 Is that by design? Quote Link to comment Share on other sites More sharing options...
davrous Posted June 29, 2018 Share Posted June 29, 2018 Yes it's by design to let mobile getting out of VR by double tapping on the screen. It shouldn't be an issue as you're not supposed to double click while in VR, no? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted June 29, 2018 Author Share Posted June 29, 2018 Kool deal ? 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.