MauJovi Posted January 28, 2016 Share Posted January 28, 2016 Hi everyone, i'm a newbie playing with Babylon.js, so be nice. haha I already saw a lot of picking meshes codes, onmousehover, onmouseout and stuff, but I wanted to use it in a loaded mesh. Especifically an .obj file. I have a 3DS exported file with a lot of shapes, and I've already achieved some part of my objective using the code below, that returns me the name of my shape(nice!). window.addEventListener("click", function () { var pickResult = scene.pick(scene.pointerX, scene.pointerY); console.log(pickResult.pickedMesh.id); }); Now I want some hover and selected effect, but I haven't seen something like that on the internet. I've tried to implement raanan's suggestion with jquery, but i wasn't successful. What can i do? Thanks in advance Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 29, 2016 Share Posted January 29, 2016 Hi! 10 hours ago, MauJovi said: Hi everyone, i'm a newbie playing with Babylon.js, so be nice. haha We'll do out best! My jQuery extension can be found here - https://github.com/BabylonJSX/Native-JS-Events , along with explanation of how to use it. This was more targeted towards web agencies that just need an embedded webgl frame but still use jquery for the rest of the site. Using jquery on your babylonjs window only for that will be redundant Another way would be to use the onPointerMove event. The second variable of this callback is the picking info. So the job is done for you Answering your question, I found a small bug with the onPointerMove function but it is fixable, for sure. anyhow, here is a playground to get you started http://www.babylonjs-playground.com/#1YHPTN enjoy Babylon! Vousk-prod. and MauJovi 2 Quote Link to comment Share on other sites More sharing options...
MauJovi Posted January 29, 2016 Author Share Posted January 29, 2016 It was easier than I thought! Thank you. Btw, as I can see on my researches about babylon, you and other contributors are doing a great job. It was certainly the main reason to me to choose this framework. Congrats! RaananW 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 29, 2016 Share Posted January 29, 2016 1 hour ago, MauJovi said: It was easier than I thought! Thank you. Btw, as I can see on my researches about babylon, you and other contributors are doing a great job. It was certainly the main reason to me to choose this framework. Congrats! Thanks! Always wonderful to hear. I made a remark about a bug - well, it isn't. I simply forgot about the conditions for picking... Here is an updated version, without making a second pick call : http://www.babylonjs-playground.com/#1YHPTN#1 GameMonetize and MauJovi 2 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.