Kilombo Posted June 29, 2015 Share Posted June 29, 2015 Good afternoon everyone, I've beeing insisting in the past few days in this intersectMesh stuff. Nothing is working to me, so, I took one example from the tutorial, parcialy adapted it (badly by the way, eheheh) and there it goes. In my example, the color of the sphere indeed doesn't change, because there's no intersection, although... he goes in the if clause, i know that because the var called targetz had a value of zero, and only changes to 50 if there's a intersection..... but there's no intersection! So? Why does it enter in the if clause and actually do some stuff, and other don't.The ball should be red on there's one intersection, and yellow, if it doesn't. Maybe i'm doing something really wrong, really not sure. Please check my examples in the playgroung and check the console: http://www.babylonjs-playground.com/#KI6GH#1 I'm insisting on this, because i'm trying to implement one NPC (non player character) and the intersections are the key part for this. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 29, 2015 Share Posted June 29, 2015 Line 46 is the magic ! http://www.babylonjs-playground.com/#KI6GH#2 When you create your elements, their position is all (0,0,0) until their world matrix is computed, which happens during the render loop.As its name suggests, 'renderBeforeRender' happens before the render loop. Kilombo 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 29, 2015 Share Posted June 29, 2015 Hi K! Hi T! Ahh yes, the very useful renderBeforeRender(). I use that puppy all the time. I'm pretty much confused, but here's #3. I'm not sure what you are trying to do with this PG, Kilombo, but we got red balls, and that's something. In order for an intersection to happen, the yellow ball needed to actually hit something, so I changed its animation path. You also had paste mistakes in lines 29-31... but that didn't affect your intersections. Kilombo 1 Quote Link to comment Share on other sites More sharing options...
Kilombo Posted June 29, 2015 Author Share Posted June 29, 2015 Thanks guys, that probably saved my day Wingnut 1 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.