Jump to content

Compounds and Babylon's parenting system problem with sphere.


Anemol
 Share

Recommended Posts

I having a problem with the "Compounds and Babylon's parenting system".

I create 2 types of trees.  Both are using a box + a sphere.

For the second type,  the sphere has a diameterY option but the physics engine  (Cannon) sees it as a sphere with a diameter=diameterY
 

https://www.babylonjs-playground.com/#QN1UFV

 

Is it normal or is it a bug?

Link to comment
Share on other sites

Hiya A.  I think this is normal.  Cannon's sphereImpostor is globe-shaped, no matter what.  No scaling allowed, on the impostor.

Cannon's meshImpostor allows ANY shape, but... Cannon meshImpostors ONLY react against sphereImpostors.  So, your flat surface/ground... would need to be the surface of a very large sphere... like a giant planet.  Then the 4-tall feuillage2 meshImpostor would bounce against the sphereImpostor planet surface.  The boxImpostors in the scene... would likely cause trouble.

You can make a "proxy object"... likely invisible... in the middle of feuillage2.   https://www.babylonjs-playground.com/#QN1UFV#1

Notice bump1, an added physics-active object in the middle of feuillage2.  Hide it by removing line 73.

It is one solution.  Not the best... but it works.  Notice how bump1 was created and parented in the middle of other things being created and parented.  Code is sort-of wedged-into the middle.  This is because parenting should be done BEFORE physics impostor-adding.  (I think that is the golden rule, if I rem right).  :)

All in all, just keep in mind that the "order of doing stuff" is important when making compounds via parenting.

I hope this helps.  We can talk more, as needed... if/when I'm around.  Others may have more/better comments/ideas, so stay tuned.  :)

Link to comment
Share on other sites

Thank you for the help and advice provided.  :)

Effectively, I had read that there were problems with the scaling method.

I thought possibly fill the foliage of the tree with several small spheres to match up the real shape (or maybe a joint)

Another question that is a little off-topic with the initial subject but bounces on another subject that i had already opened. 

Still with the Cannon plugin, i have an object composed of a box, a wheel (the motor) and a hinge joint.

I have a server who is running a scene (null engine) and i have to update the client scene. I was wondering what is the essential information to broadcast to properly update the object in the client scene, and if there was a specific method for that use.

For example, i was looking at Lance.gg which talks about serializing information, but what would be the information to serialize and especially for a complex object like mine? ( position, angular/linear velocity, quaternion  only?)

 

 

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