Jump to content

Is it possible to enable collision to mesh that attach to animating bones?


Recommended Posts


I am trying to make a goalkeeper game, which require goalkeeper mesh body to be able to "block" any football that hit toward him. The best would be the mesh collider that represent the goalkeeper to be reasonably precise while not being overkill, so I created boxes, set their physics imposter, and attach them to each bone. which look like this: http://www.babylonjs-playground.com/#SRR6Y2#1

however, I don't know how to make each box collidable to the falling sphere,  did I miss anything, or does it require more complex way of implementation?


Link to comment
Share on other sites

Hi AB95!  I like your project! 


It is not "fixed" yet... but this PG is "different".  :)


-  Lines 5/6 - changed to OimoJS physics (default is CannonJS).  Oimo seems to be running much faster, in this project.  Also increased world-step speeds... making physics engine update faster.
-  Lines 8/9 - changed some camera orientations
-  Lines 25+  - changed a variable name to proxyMesh.  'proxy' ~=  something doing a task for another something.
-  Lines 29 & 48  -  .checkCollisions = true... is NOT USED on physics-engine colliding.  That is for a different collision system, built-into BJS core, used for colliding freeCams with mesh, in FPS shooter games.
-  Line 32  -  I added some mass to each proxyMesh box.  Not sure if needed, but added anyway.
-  Lines  32 & 49  - proxyMesh.physicsImpostor  & ball.physicsImpostor - keep these lower-case.

We have SOME physics active, now.  But, the proxyMesh boxes are still not colliding with the falling balls.  Balls ARE colliding with floor and with each other.

I am going to ping physics expert @RaananW and see if he wishes to comment.  He might know things about bone-animated physics impostors.  I also invite @Raggar to comment, who has done some fine physics work, including some rag-doll skeleton stuff.  @Samuel Girardin is invited, too... another rag-doll and physics pro.  All other commenters are welcome, too, of course. 

I have done some physics, too, but I have never tried to use moving impostors whose positions/orientations are controlled by bones.  We might need some kind of forceUpdate() of each impostor... each frame of the animation.  Not sure. 

We MIGHT have an issue with SO MANY impostors... overlapping each other.  We might need to ONLY add proxyMesh/impostors on CERTAIN bones...  far less mesh than current numbers... to avoid that impostor overlap.  In some cases, overlapped physics mesh... automatically try to de-overlap... and it can be violent.  :)   Mesh are sometimes sent flying in all directions.  :)

Stay tuned for more comments.

Core/PG Team:  On-console, I am seeing BJS - [08:04:52]: Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.  ...AFTER a playground SAVE and attempted re-RUN.  Anyone else seeing that?  FF 52 ESR.

Link to comment
Share on other sites

  • 2 weeks later...

Wanted to ship in after a long time :) 

The problem was the parenting on the bone meshes. To prevent that you can use the (perfect!) solution of @Ragger, or to understand how the physics engine does it internally you can create Independent mesh that has its position updated on every frame:



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.

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.


  • Recently Browsing   0 members

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