# Rotation of an object around a point

I want to rotate an object around a point, there is a solution to make the object a child in relation to the point, but this option does not work for me.
I want to move the object itself, not the point. I want the pivot to be positioned in the object’s local coordinate system. It should be so that when moving the pivot point remains in place in relation to the object. Moving the pivot point should not affect the object (change its position)
How to implement this in react three fiber

Sounds like it’s not a pivot then?

It should be enough to move the parent of the pivot - then the point is moving, but the relation between pivot and it’s object doesn’t change (for as long as the object is a child of the pivot.)

Second point kinda contradicts with the thing quoted earlier though - if moving the pivot should not affect the object, then relation between the pivot and object cannot remain unchanged when moving the pivot?

Let’s say I have a cube, I want to rotate it around its edge, but I don’t want the point to be the parent element.

Wouldn’t in that case Object3D.rotateOnAxis / Object3D.rotateOnWorldAxis be enough ?

Optionally, you can always use Matrix4 multiplication if you’re into math. Basically just create translation and rotation matrices, add them up, and apply to the object.

about the latter in more detail, I’m not good at mathematics and would like to know how to do it

It’s surprisingly easy - here’s a nice article explaining it (but you don’t really have to understand matrices to us them, three has a few built-in methods to create them, then you just multiply - just remember that the order of multiplication matters in this case.)

1 Like

And you can give a code. To be honest, it’s hard for me to understand something if it’s not shown in the code.

could you go a little more in detail as to why you dont want a pivot? for instance like this: Basic demo (forked) - CodeSandbox (click the box). i do not understand the slightest bit of math and have survived almost exclusively on pivots.

is it because you need the pivot axis to be variable?

2 Likes

i looked through stack overflow, is this more what you need? Basic demo (forked) - CodeSandbox i have no idea what i’m doing at this point, but it’s not pivoting the parent any longer.