The gaps between the blocks when they are rotated

What causes gaps between the blocks? I noticed that they appear after this line

this.billboard.rotate(BABYLON.Axis.Y, -Math.PI / 7, BABYLON.Space.LOCAL);

Impossible to tell from an image and a line of code. Please post a PG with one set of blocks.

PG: https://www.babylonjs-playground.com/#AYD85K#31

Sorry I do not see the gaps.

They appear after I change their mass to a positive number. This happens 2 seconds after the construction is completed.

setPositiveMass does not appear to be called in this PG.

Also I know resetting a mass can be an issue but not one I can help with.

However a PG showing the problem could give those knowledgeable about physics engines a start.

Searching mass in the forum shows issues and sometimes solutions for the changing mass problem.

But the problem arises only if I turn the blocks around their axis. Otherwise, everything works as it should

The PG you submitted does no show the problem and so I cannot give any advice. I am using FireFox 75.0

Please post a PG with the issue.

Maybe you can see on my site: http://test3.avior.by/site/car/build/index.html
It’s necessary to drive so that the car collides with the buildboard

PG: https://www.babylonjs-playground.com/#N00Y7B

Sorry, my fault that I threw the wrong playground

@Cedric would you be available to check out the issue. Commenting out line 104 or 171 makes a big difference.

You will probably need to read most of the topic to understand.

Rotation issue or a change mass issue??

The essence of the problem: I create a billboard from physical cubes with 0 mass and rotate their parent. When the car crashes into a billboard, I immediately change their mass to positive so that the billboard breaks up. Everything works if the billboard is not rotated. Therefore, answering your question, I think the problem is in the rotation

I also think the issue is the rotation but in conjunction with the parenting. Once rotated, the axis aligned world bounding box is bigger but the parent transform is not taken into account for physics impostors (there are constraints for that). That’s why there is a ‘bump’ when the rigid body is initilialized (from static impostor to dynamic with max).
Can you try to create the cubes without parenting? You’ll have to recode the computation for position/rotation lines 129/130.
I think it’s a bad idea to parent meshes while setting them as independant with rigid bodies.

2 Likes

@Cedric Thank you for you help, makes sense.

Maybe my idea is bad, I just didn’t know how to rotate each square separately to get a clear picture

Cannot work out how you are applying the image to each box, you could try this instead Apply Material to Individual Faces - Babylon.js Documentation