Cylinder positioning off (maybe changed?)

Hi. A while back I used this playground to make some cylinders and balls
https://www.babylonjs-playground.com/#1RWE59#12

My script now has cylinders misaligned, similar to the cylinder in the playground now being misaligned. Any thoughts on getting this playground back to working order?
Thank you!

Hi @james-3d an welcome back. There was a breaking change in setPivotMatrix a couple of years ago Pivots | Babylon.js Documentation. You now need to add a false parameter to older projects https://www.babylonjs-playground.com/#1RWE59#387

3 Likes

Thank you, @JohnK. Nice targeting. You got me working, again

I had a divide-by-4 rather than a divide-by-2 in https://www.babylonjs-playground.com/#1RWE59#387. If you change the ‘2’ to a ‘4’ in this playground, it shows my issue. My cylinders are back in their rightful place. Thank you!

good
    // First of all we have to set the pivot not in the center of the cylinder:
    cylinder.setPivotMatrix(BABYLON.Matrix.Translation(0, -distance / 2, 0), false);
bad
    // First of all we have to set the pivot not in the center of the cylinder:
    cylinder.setPivotMatrix(BABYLON.Matrix.Translation(0, -distance / 4, 0), false);
2 Likes