hit2501 Posted August 2, 2015 Share Posted August 2, 2015 Hi. Anybody know how to use the OnPointerOverTrigger (like this: http://www.babylonjs-playground.com/#21YCLG#1) with a Drag n drop function? I tried using the code in the example and works fine but not when I drag over the mesh an html element (image). How can I do it? Thanks. Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 2, 2015 Share Posted August 2, 2015 Uhm.. just use both code snippets? How did you implement drag and drop? http://www.babylonjs-playground.com/#GOCIX (hover over donut, then drag donut) Edit: after re-reading your question I think I misunderstood what you meant. So not sure what you mean. Can you show the problem in a playground? I cant really imagine what's not working. Quote Link to comment Share on other sites More sharing options...
Gerente Posted August 3, 2015 Share Posted August 3, 2015 Something like this: http://www.babylonjs-playground.com/#RD8NR ? Quote Link to comment Share on other sites More sharing options...
hit2501 Posted August 3, 2015 Author Share Posted August 3, 2015 Thanks for your replies, this is the code I´m using to drag and drop an html image over a mesh to change the texture (and other actions):var file = document.getElementById('file');var startdrag = function(evt){ evt.dataTransfer.setData("text/plain", evt.target.src);}file.addEventListener('dragstart', startdrag, false); var canvas = document.getElementById('renderCanvas');var dragover = function(evt){ evt.preventDefault();}var drop = function(evt){ evt.preventDefault(); var src = evt.dataTransfer.getData("text/plain"); var pickResult = scene.pick(evt.offsetX, evt.offsetY); var ImageNameIndex = src.lastIndexOf("/") + 1; var Imagename = src.substr(ImageNameIndex); console.log(evt.offsetX, evt.offsetY, pickResult); if(pickResult.hit){ //HERE SOME CODE TO CHANGE TEXTURE OR OTHER STUFF... } canvas.addEventListener('dragover', dragover, false); canvas.addEventListener('drop', drop, false);})What I need is when I drag the html image over the mesh, the mesh must be highlighted (any emissiveColor) before I drop the image over the mesh to change the texture. once more thank you. 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.