Hi all
I’ve been attempting to create my own simple collision system on Babylon.Js, as well as position things around the world.
I’ve noticed that by default, the (0,0) position on a mesh object from the meshbuilder is in the center point of the object.
This isn’t great, as it means all of my calculations would have to use half of the size of the object every time, it’s not very clean.
I’ve noticed that the setPivotPoint function doesn’t seem to effect this, but does have an effect on scale or rotation (which I’m not too interested in).
Hiya SS, welcome to the forum. What you wish is easily possible. I think your best step… is a little docs search about the ‘pivot’ subject: Babylon.js Documentation
setPivotPoint() has a best friend named setPivotMatrix()… also handy. IT has a new 2nd parameter (true/false) that indicates whether/not the mesh should be re-positioned after the pivotMatrix is changed. Docs tell all about it.
I would have thought that with this, the position the box would be set to would be different places each time, what with the pivot being different. This doesn’t seem to be the case.
Thanks so much JohnK, that seems to work perfectly!
It looks like this isn’t a feature of set pivot point, which I was preferring to use because matrixes can be a little intimidating.
I have to get over that eventually lol