Jump to content

workercollisions & movewithCollisions = not moving


Recommended Posts

Yes,, I can say its working ,, but not with clonedMesh & workerCollisions = true


If I use instanced mesh its ok,,, but I need to make cloned mesh with cloned skeleton,,,,,,,,, do I need to clone collider or is there something else I need to turn on, setup after cloning  to get collider working ?





I need same skeletal characters but I need to clone them to play separate animations on them..... with instanced skeletalMesh we cant play different animations,, they are playing same animation all the time right ?


correct me if I am wrong



+ tested  with workerCollisions=false      --- > works with instances & clones

+ tested  with workerCollisions=true       --- > works with instances    BUT doesn't work with clones

checked 3 times to be sure


As I saw in latest 2.3 alpha release there was bug fix with workerCollisions and instances,, maybe now this fix should be applied to clones xD 


strange is if I create another clone while playing game or just create only one clone at runtime  ,,, collisions works 


 if there is array of object clones to create problem is here,,,,,,,,,, for example if tell engine to create object every 0.5s --- > GOOD working.

Link to comment
Share on other sites

  • 3 weeks later...



i found a strange thing with enabled workercollisions and moveWithCollision (using latest babylonjs 2.3 alpha - downloaded today).

I get an imported mesh position before call moveWithCollision, and after the call, the mesh position is the same. If i use a setTimeout, receive the correct position. I did this in registerBeforeRender event.


But everything works fine, if i disable workercollisions. Is it a bug, or i missed something?

Link to comment
Share on other sites

Ah. I see the problem.


The thing is - witht he worker it all works async. The moveWithCollision function only updates the mesh's position after the function called it finished, and you can therefore not get the right result (If you need a better explanation, I will be more than happy to provide it :-) ).

This is usually solved with callbacks. Now, in that particular case, there is a callback being called. It is a private function in AbstractMesh that receives the new position and updates the mesh. you COULD change that, but let me see if I can find a better way to integrate it.


Just so you understand what I mean by overwriting it - http://www.babylonjs-playground.com/#P5NX1 . This will work correctly on both true and false.

Link to comment
Share on other sites

Thank you for your quick response.


I thought that it works async, but i was not sure in that. Sorry for that, i'm new in babylonjs.


An integrated solution would be great, but if you dont have enough time, i'll try to do it (just in this case, i have to do it again, if i download a newer version :/ ).


thanks :)

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