Rotating Vector Point Around Another Vector Point

I have 2 vector points(one of them belongs to object meaning that it also has orientation axis which means that it also has local space) and a float angle in radians.
The 1st point has orientation. It’s the origin of this mechanism.
The 2nd point is a fake vector point in world space. It’s just an imaginary particle. It has no orientation or other parameters which often belongs to ordinary objects.
I need to rotate the 2nd point around 1st point. I have the rotation value. I must rotate it around objects X axis. This image may help to understand the situation:

As you can see, I must actually change the position of particle as if it would change if I rotated the object around the origin by the exact angle. It must be rotated only around single exact axis(in this case it’s X). The origin shouldn’t be changed in any way. In the result I need world position of the vector.


Wait, I could actually use the object space as a world for the particle. In this case I need to know how to convert object space to local space(a point relative to an object). I know that it has something to do with orientation matrices, but I’m not sure about the full workflow.

Well I don’t know what kind of object it is but you could try applyImpulse() for rigid objects

No physics. Nothing like that. Just pure math.

physics driven version, (physics is math*) - see file

math version = add empty and parent object to empty, rotate empty.

math version 2 = get localized point, rotate a empty, apply local to empty

empty.worldOrientation = own.worldOrientation

local = target.worldPosition-own.worldPosition
local = own.worldOrientation.inverted()*local


target.worldPosition = empty.worldPosition+(empty.worldOrientation*local)


DefaultCubeDanceParty.blend (602 KB)

you can do the same adding another empty(B) on the root(A) without offset.
and then parent another empty © to B.(with offset)

at this point all still to do is rotate B (…C rotate around implicitely)
using the local matrix (not world):

B.localOrientation = Matrix.Rotation(x_rot,3,“X”)

####that is the same as :
B.localOrientation = x_rot, 0, 0

if you cannot use empties for some reason you can simulate it:

vector_offset = Vector((1,2,0)) # the local position of particle

x_rot = get_rotation()

particle_worldPosition = root.worldTransform * Matrix.Rotation(x_rot, 4, “X”) * vector_offset

Thanks everyone.
I’ll try MarcoIT’s no-empties version. It should work well. And than I’ll use BluePrintRandom’s last equation to convert to worldspace. Hopefully will work;)

OK! Here is some more info:

  • I need to do it in pure math space. Without using any additional empties.
  • I can use local space(assuming that the root object is the origin of particle’s world).
  • The step for world space conversion than is very simple. This way I don’t need to worry about it.

Now the question is - how to do this type of roation in local space?

rotation_x = mat([[1, 0, 0], [0, cos(a1), sin(a1)], [0, -sin(a1), cos(a1)]]) - found it being easier for me to just make a matrix:D a1 = the rotation angle around x axis
Problem solved!:wink: