Set pivot point and maintain multiple rotations

I have a box and I want a user to be able to set a pivot point and rotate it multiple times each time setting a new pivot point.

I believe the only way to do this is to create multiple parents of the box because there is only one rotation vector for a mesh and once a new pivot is set the old rotation is lost or its lost if the mesh is rotated with the new pivot…

In other words there is not history of rotations on a mesh

So I’m left with creating a tree of parents or perhaps baking in the transformation…

Is that right?

Rotation can be preserved when changing the pivot but there will not be any history unfortunately.

So you solution is probably a good one:)

the method addRotation() can accumulate rotations one after the other : Babylon.js Documentation

Nothing to do with pivots though

1 Like

What is the performance penalty for multiple parents? For instance a mesh without a parent and one with 20 just being used for different pivots? What is the performance hit for multiple baked in transformations? Thanks

Having a parent is only expensive when the mesh world matrix is updated. So performance penalty should be unnoticeable

1 Like

Thanks, does that include the arc rotate camera, in other words if I had a box with no parents and a box with 20 parents I could move the camera view around them at the same performance because i’m Not changing the world matrix of the box ( or its parents)

Wingnut goofing-around… using NO parenting: playground

Supposed to call the spin() function… with a random axis (“x”, “y”, or “z” - first arg)… every three seconds. It also sets pivotPoint or pivotMatrix… to some random corner of the box - every three seconds.

rand() function gotten from the web… not sure how stable it is. :slight_smile:

Lines 55/56… seem like they COULD be useful, but I’m not applying them correctly. As OP mentions… box is jumpin’ around with most pivot-sets.

The pivot-setting functions in BJS were recently updated. I might not have studied the new ways.

PG is not doing so well. Wingnut playing with power tools that are beyond his intelligence, as usual. heh.

Sorry for interrupting. GameDev has a pending question in the previous post.

You assumption is correct