Difference Between Bounding Box and Transform Node

Hello community!
If I have something composed with 2 different meshes :
example : snowman ( 2 spheres)
I saw in the documentation two different approaches :
1-Bounding Box
2- Transform Node
What is the difference between them ?
And which one to use , If I want to combine these 2 meshes as they are making one object(the snowman) :ex : for making one action Manager for the snowman not for each mesh

Thank you,

The bounding box is the area that the mesh is contained within. This is for culling and collisions etc. The transformNode you could parent both spheres to and could move them around as a single unit. This would still make them two meshes though just with an in common parent transform. If you want to make them a single joined mesh, look at the merge mesh function.

But if you just want them to have similar actions you can make a single actionmanager and then set both spheres action manager property to the single action manager if you want them to have the same behavior.

1 Like

So I Want to move the snowman with respecting collisions ; I need the bounding box ?
Is there any cases where the 2 (transform node and bounding box) are applied to an object (ex: snowman)

You can make a compound collider.

1 Like

My required behavior is to drag(move) the snowman without touching other objects (without making collisions (ex:with other snowmans) ) using the moveWithCollisions , but the snowman is composed from 2 meshes(2 spheres) ; in this case what is the best approach ?
if there any playground example that may help…

Thank You

First of all, you may perform Playground search for moveWithCollisions - Playground search page | Babylon.js Documentation
There are a lot of working examples there, I hope you’ll be able to find what you are looking for.

Then make a actionManager and attach it to both spheres. Parent the spheres to a transformNode, and then have the drag action move the parent transform node. Ezpz.

1 Like

I made the 2 spheres childrens of a transform Node ; and attach drag events to the transformNode ; the snowman is moving ; but what to do with the collision ?
moveWithCollisions can’t be used with transform Node

Make a compound collider.

Or make an invisible box mesh around the spheres and use that as your parent mesh with a collider.

Thank you for your suggestions!
I made a simple playground example(with a simple mesh for now not a snowman) to show you what I did
let assume that sphere1 is the sphere that I want to move without collisions with the second sphere

is there anything that I missed ?

I will really appreciate if you can check my example …
Thank You in advance

oof I would go about this a totally different way. One second.

There are a million ways to do this, and the way I set it up is honestly overkill and not even the best way to do it.

If I had just snowmen that I was having to move around a plane with other snowmen id do a real simple AABB algo and just check if the

snowmen.forEach( otherSnowman =>{
if(snowman == otherSnowman){return}
let direction = snowman.position - otherSnowman.position
const distance = direction.length()
const r2 =  snowman.lowerRadius + otherSnowman.lowerRadius
const eps = 0.001
if(distance < r2){
 snowman.position = otherSnowman.position - direction.normalized().scale(r2 + eps)
}
})

snowman.position - otherSnowman.position < snowman.lowerRadius + otherSnowman.lowerRadius on all the snowmen and if it came back with a true I would offset the snowman by the direction times the sum of the lower sphere radii.

If you are trying to move with physics then we have to do something completely different, this is a cat skinning question. There are a million ways to accomplish it just grab a method that matches your needs the best and make it work.

1 Like