IntersectsMesh vs actionManger

repro: Babylon.js Playground

Uncomment line 35.
My question is: did something happen with assigning position to meshes that conflicts with registerBeforeRender and intersectsMesh?

I have a feeling this is a dumb question (its late and I need to hit the sack). But what am I missing?

Good ol’ computerWorldMatrix! :slight_smile:
intersectsMesh vs actionManager | Babylon.js Playground (babylonjs.com)

What happens is that on the first frame the world matrix of the box still allows it to “intersect”, because it is in 0,0,0. When you set a new vector as position it is forced to re-do this calculation. Otherwise you can run it yourself to be sure that it’s working as expected, or move to afterRender (if it makes sense to the usecase)

2 Likes

Got it, thanks! Gonna presume the actionManager does the world matrix computation internally.

Is there a visual flowchart/high-level breakdown of the processes involved in a single frame of render for a single scene? Like what happens before or after, when matrices are updated, the order of observables that trigger etc. I feel this might be useful for advanced users, just curious, no urgency or anything…

You know, this would be some an amazing thing to have. We don’t have it (at least not so detailed), but TBH I will need it for a future work I am planning on doing so it will make sense to make one. Won’t happen any time soon though, unless someone else has the time to do that.
Otherwise - the code is open. The render function is in scene, and every component has its own magic happening when a single frame renders.

1 Like