Dad72 Posted July 10, 2014 Share Posted July 10, 2014 Hi IntersectMesh does not work with moveWithCollisions. I would like to be able to create events when mesh with a collider (ellipsoid) and it encounters another mesh (intersectsMesh). ellipsoid.intersectsMesh(Portail, false)); It works when I try without elipsoid but not with. Thanks Deltakosh Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 10, 2014 Share Posted July 10, 2014 Could you elaborate a bit more because I don't get it Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 10, 2014 Author Share Posted July 10, 2014 J'ai des portails de téléportation qui me permettes d'aller d'un point A a un point B. Le portail A a un intersectMesh qui permet de vérifier si le personnage entre en collision avec.Quand j'utilise mesh.ellipsoid et que je vais avec moveWithCollisions() vers ce portail A, IntersectMesh ne fonctionne pas.par contre si je n'utiles pas mesh.ellipsoid, IntersectMesh fonctionne a nouveau.Je pense que c'est parce que moveWithCollisions utiles déjà une vérification de collision, mais je sais pas. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 10, 2014 Author Share Posted July 10, 2014 It is not the same question, but this still concerns of moveWhithCollisions.I just of noticed that moveWithCollisions consumes a lot of FPS. 60fps => 40fps when my character is in motion. Is it normal that it consumes more than physics?And intersectMesh does not work when using mesh.elipsoid PS: mesh.elipsoid should be a trigger that would create an event on the collision detection, which would return a be able to traverse the object while detecting the collision (with onCollisionsEnter() for example). You think what DK? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2014 Share Posted July 11, 2014 mesh.ellipsoid is not an object. This is just a vector3 that helps defining an ellipsoid around the mesh.mesh.intersectMesh must be used with a mesh as parameter: mesh.intersectMesh(otherMesh) And beware: your player is an empty (Dummy) object. You hsould think about adding an invisible box around it (and make this box child of the player) and use this box to check intersections "I just of noticed that moveWithCollisions consumes a lot of FPS" This is because you are doing collisions against the ground. I suggest using optimizations described in the "Optimize collisions and picking" chapter of the wiki: https://github.com/BabylonJS/Babylon.js/wiki/Optimizing-performances-with-octrees Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 11, 2014 Author Share Posted July 11, 2014 Thanks for your advice Deltakosh. I do like this. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 11, 2014 Author Share Posted July 11, 2014 Ok, IntersectMesh works now with a sphere in parent to the character. **For the problem of FPS: Regardless of the value that I put to optimize the field I am a 21 fps, it's even worse. moveWithCollisions() // 40fps+ground.optimize(30000); // 21 fpsorground.optimize(3); // 21 fps without it I am a 40 fps. but I find that when I use optimizes and I move my character I still has 21, so it works, but the I loses 20 fps Additionally (40 fps lost in total). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2014 Share Posted July 11, 2014 This is not waht the doc says: Please use that:mesh.subdivide(100) then mesh.createOrUpdateSubmeshesOctree(16, 2) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 11, 2014 Author Share Posted July 11, 2014 yes, I have read the doc, i use octree: var = octree scene.createOrUpdateSelectionOctree();octree.dynamicContent.push(mesh);mesh.useOctreeForCollisions = true;I wanted to also add ground.optimize. but it's worse.If I use:mesh.subdivide(100);mesh.createOrUpdateSubmeshesOctree(16, 2); So I'm going from 40 to 15 FPS This changes nothing either. and the character disappears following the rotation of the character. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 11, 2014 Author Share Posted July 11, 2014 I try to only use this field:ground.subdivide(5);ground.createOrUpdateSubmeshesOctree(64, 2);and I turn a 57, which is perfect. GameMonetize 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.