benjydel Posted March 5, 2016 Share Posted March 5, 2016 Hello, i would like to create a selector like this : http://threejs.org/examples/#webgl_interactive_voxelpainter (I know it's three.js but I don't find it with babylon) My goal is to allow the user to create a cube at the cursor position. I manage to move the red mesh which represent the cursor but i don't know how to detect the collision and stop the movement of the mesh. I tried to use moveWithCollisions but it don't work well when i move fast the pointer. Do you have an issue ? Thank you in advance Quote Link to comment Share on other sites More sharing options...
eboo Posted March 8, 2016 Share Posted March 8, 2016 extract needed parts from this: http://www.babylonjs-playground.com/#2ILHWS#3 if you have your playground, maybe we can help you Quote Link to comment Share on other sites More sharing options...
amorgan Posted March 8, 2016 Share Posted March 8, 2016 Please take a look at picking collisions: http://doc.babylonjs.com/tutorials/11._Picking_Collisions If the canvas is not of width: 100% and height: 100%, then you might want to make sure you account for the offsetX and offsetY. (Refer to: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent for more information). This might have changed, but just in case. Also for Mac users you will want to also pay attention to window.devicePixelRatio if you are doing any html element manipulation (this shouldn't be relevant for you, but depends what you want to do) Hope this helps further! 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.