Download

Rotate about a vector

I have a problem where I want to rotate an Actor about an arbitrary vector, I wonder if there’s a standard way of using blueprints to achieve that.

I would also take a C++ solution of course.

As a side effect of that problem, I encountered ono more smaller issue:
-I want to know how to extract a vector representing a straight line of a static mesh. For example, given a door frame which is rotated 5 degrees around the X axis, how do I extract the vector going through two adjacent corners of it, without going through the calculation (perhaps there’s a tool of extracting world coordinates points, which of course will do the trick).

If your models are done right (they are on grid and are properly rotated) you can always get up,right,and forward vectors. So if your door is aligned to 90deg or 0deg in 3d app, you could get right or forward vector. There is no general solution to find 2 corners of arbitrary rotated mesh.

To rotate around arbitrary vector:

  • get forward vector,
  • rotate it around your vector (there is blueprint node to rotate vector around axis).
  • you should get new vector,
  • use “Find look at rotation” from [0,0,0] to your newly rotated vector.
  • you get rotator as result, now rotate mesh.

Thank you very much, you completely solved my problem, I just need to follow the numbers in order to turn this into a smooth animation.