3
$\begingroup$

I have 2 points p1 = (0, -1, 1) and p2 = (0, -1, 0). I am trying to rotate p2 around p1 with the axis of rotation as the x axis. So:

  • I subtract p1 from p2 to get the vector V,
  • rotate V with using Vector Rotate node with center at p1 and axis = (1, 0, 0) through a certain angle,
  • add p1 to the resulting vector to get the new location of p2

Now if I change the angle in Vector Rotate node, the rotation angle does not correspond to the actual angle on view port. For example with the angle value around 37, the view port rotation angle is already close to 90 degrees.

Vector Rotate Issue 1

Strangely, with p1 at origin there does not seem to be any issue and both the angle in the node and on view port correspond exactly.

Vector Rotate Issue 2

How is this anomaly to be explained?

There could be other ways of achieving the rotation, but I am interested in knowing why Vector Rotate behaves the way it does.

$\endgroup$

1 Answer 1

4
$\begingroup$
  • I subtract p1 from p2 to get the vector V

That is the vector V, from (0,0,0), (the object origin).

  • rotate V with using Vector Rotate node with center at p1 and axis = (1, 0, 0) through a certain angle,

You are rotating the point at the end of V around p1 , not V's other end, which is at (0,0,0)

  • add p1 to the resulting vector to get the new location of p2

For that to work, you would have to have rotated about (0,0,0) at step 2.

You could forget the subtraction and addition altogether, and just use the point p1 as the center of rotation for the point p2. The local rotation is thereby already provided by the node.

Because you can set the center of rotation, you don't have to: (move to origin + rotate about origin + move back to where you started)

Thanks very much to @Kuboå for this illustration!

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ I was preparing an answer but now I see you already did. Would it be helpful to add this illustration to your answer: i.imgur.com/nqq4ceq.gif ? $\endgroup$
    – Kuboå
    Commented Dec 14, 2022 at 15:34
  • $\begingroup$ @Kuboå Oh, my! You've gone to so much more trouble than me! Excellent illustration. I hate stepping on good answers. Nick it back for one of your own, if you like :) $\endgroup$
    – Robin Betts
    Commented Dec 14, 2022 at 16:25
  • 1
    $\begingroup$ Nah, it's alright, it's the same answer really, just illustrated because I remember the time when I was confused about this as a beginner. I wasn't even aware of the concept of a "position vector" and no tutorial ever mentions it, so I had to find that out by myself. Whenever I feel like I'm getting the hang of GN some simple question makes me realize I actually don't know the fundamentals that well. It's painful :D Anyways, I cleaned it up a bit in the meantime so I'll change it with that. Cheers. $\endgroup$
    – Kuboå
    Commented Dec 14, 2022 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .