isigui Posted December 19, 2013 Share Posted December 19, 2013 Hello,I'm loading my scene from Blender, containing a simple plane (acting as ground), a camera and a light.I put a sphere (diam 1) on my ground and a ray with origin the center of the sphere and the vector direction (0,-1,0) When I move the sphere on this ground (say on the z axis only for example) , I check the altitude of the ground with scene.pickWithRay using the predicate to exclude my sphere. This works. But, when my sphere comes at the middle of the ground(for example), I clone this ground, change its id and set its position (z axis) at the end of the last ground (to fake an "infinite road"). My problem is that when my sphere comes on the second ground, the method scene.pickWithRay does not hit anything ..;o(( When I used the method Mesh.intersects(Ray), I had to express the ray in the world of the Mesh I wanted to test against. But I think I read in the forum that scene.pickWithRay does not require to make this transformation. Does the problem comes from the fact that I clone the "ground mesh" and set its position via mesh.position ?? Thanks for your help ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 20, 2013 Share Posted December 20, 2013 I think you can try to call computeWorldMatrix on your new mesh to ensure that the bounding boxes are setup correctly Quote Link to comment Share on other sites More sharing options...
isigui Posted December 20, 2013 Author Share Posted December 20, 2013 Hello,Aie, I just find out my problem, trying to apply what you advised.My Ray origin was not positionned correctly .... Everything is ok, scene.pickWithRay is greaaaatttt !!!!Regards.Guillaume. 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.