Rotate Around Point that is NOT its Parent Possible?

Is there anyway to rotate an entity around an arbitrary point that is NOT its own parent’s position or its own model’s pivot point?

It just that currently having to reparent,move,reposition,rotate and tween etc is unwieldy and complicated especially when as well the transform from the new parent gets inherited. In fact in my current situation it practically impossible. eg. In my gameI click on an object which has collision which is a child of a group of objects. That object tweens to a position then I need to generate a central pivot point from that object and any children of that object and then make that pivot the parent of all those objects…Then rotate the pivot.??? If this sound complicated in theory its even worse in practice because when reparenting things inherit transforms.

Any kind of Rotate Around function?

Hi @Grimmy,

No, there isn’t a method like that in PlayCanvas. You could potentially write your own method using vectors/quaternions.

Here is the source code of the RotateAround() Unity method, in case it’s of help as guidance:

Thanks but I would have no idea where to even start. Maybe there is something in the api to adjust the pivot point of the existing model?

You will have to study the engine source code, but I think it will be equally math involved. Usually what devs do is what you did before, use a dummy hidden entity.

1 Like

t adjust the pivot, you could extract positions / normals out of the mesh, transform them to be relative to your new pivot point, and write them back.

This could be tricky for compressed mesh formats (draco, meshopt and similar), but without compression should be pretty straightforward.

but I agree that having a dummy parent is typically easier.

1 Like