TomaszFurca Posted July 25, 2017 Share Posted July 25, 2017 Hi, in my project i have a lot modules which must register anonymous function in sceneAfterRender. Some of them uses intersectsMesh. What you think about check mesh is active, before check intersects? For example checking player collisions, with only colliders, which are visible in camera: for (var i = 0; i < colliders.length; i++) { var mesh = game.sceneManager.environment.colliders[i]; if(scene.isActiveMesh(mesh)) { if (this.mesh.intersectsMesh(sceneMesh, false)) { ... } } } Tomasz Furca Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 25, 2017 Share Posted July 25, 2017 One thing about mesh level beforeRender & afterRender functions: they themselves are only called if the mesh they are attached to are active that frame. If you think there is no likely hood that a mesh that is active could intersect a mesh that was not, then should work. BTW, a scene level beforeRender & afterRender always runs. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 25, 2017 Share Posted July 25, 2017 also forgot to mention, I am pretty sure if you have multiple cameras (VR), mesh level beforeRender & afterRender get called multiple times. You might put in checking for the renderID as well, if you plan such a deployment. This is one of the reasons for a QI.Mesh that I use a scene level beforeRender, even though I have one for every mesh. Quote Link to comment Share on other sites More sharing options...
TomaszFurca Posted July 25, 2017 Author Share Posted July 25, 2017 Thanks for replay, but what you think about this scenario. Player - have register function in render loop too check collisions with colliders (this is array of all meshes in scene, which are colliders for player). In loop are meshes, which we don't see on camera. 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.