Anemol

Compounds and Babylon's parenting system problem with sphere.

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?

Share this post


Link to post
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.  :)

Share this post


Link to post
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?)

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.