Jump to content

moveWithCollisions with intersectsMesh


Dad72
 Share

Recommended Posts

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 fps

or

ground.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).

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...