Zerocaliber Posted November 13, 2013 Share Posted November 13, 2013 Hey guys. I actually just registered when I was trying to find an answer to this and google led me to another forum post on this forum. Basically, I am working with the babylon.js library and I am unsure of how to properly accomplish something. I currently have a terrain mesh and another mesh that I am using as the "targeting indicator" which is currently in the shape of a basic sphere. When the mouse moves across the terrain, the indicator is supposed to move to the position on the terrain corresponding to the mouse position. The problem is that, whenever the targeting indicator moves over to a spot, it then blocks the terrain mesh position used in future calculations with its own position/surface until the mouse leaves its mesh area. Is there any way to specify scene.pick to exclude certain meshes? How would I go about getting the terrain mesh's position instead of the target indicator's position? I can provide some screenshots if you need me to be more specific. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 13, 2013 Share Posted November 13, 2013 The third parameter of scene.pick is a predicate function that will allow you to select the meshes you want. You can also set mesh.isPickable = false if you want a simpler solution Quote Link to comment Share on other sites More sharing options...
Zerocaliber Posted November 14, 2013 Author Share Posted November 14, 2013 Ah, silly me. Thank you very much for that information! Quote Link to comment Share on other sites More sharing options...
Zerocaliber Posted November 14, 2013 Author Share Posted November 14, 2013 By the way, how might that 3rd parameter function look to select a mesh "m"? Something like this? scene.pick(x, y, function(mesh)){ return mesh === m;}); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2013 Share Posted November 15, 2013 Correct Quote Link to comment Share on other sites More sharing options...
Zerocaliber Posted November 16, 2013 Author Share Posted November 16, 2013 Thanks! 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.