Download

rotation around custom axis

hi,
i need to rotate my scene component around an axis in blueprints. this axis of rotation is being updated using event tick.
i already know how to get the angle between two 3D vectors using a.b=|a|*|b|cos(theta)
and also the axis of rotation from (axb)
i just dont know how to apply rotation knowing the angle and axis of rotation in blueprints.

my scene component is a simple cylinder with one end on the center of world coordinate (this point is like a spherical joint).

the nodes setRelativeRotation and addRelativeRotation do not take axis of rotation.

i really need some help on this
regards
Shayan

You could use a physics constraint and set the constrained actor 1 as the cylinder and the constrained actor 2 as blank (the world). Then lock the one and two swing motions, keep the twist motion free.
Because I don’t know the math to rotate around a custom axis…:stuck_out_tongue:

thanks for your reply, but my simulation does not have any physics involved. its pure inverse kinematics with no force consideration.
I already know the math behind it, however, I dont know how to apply that in blueprints.
at least I have found similar thing in c++ “RotateAngleAxis”, but if someone could help me bringing it blueprints, that would be awesome

Have you tried add local rotation?

addLocalRotation does not take any rotation axis as an input (correct me if i’m wrong).
or, is it possible to say, get the current upvector and the new upvector. then orientate the object in such a way that new orientation has the new upvector?
my axis of rotation is always on the x-y plane passing through the center and this axis is not fixed; it changes all the time

to just make it clear, there are 6 actuators in this stewart platform. so I put cylinder for each actuator and they are attached to the lower platform with spherical joints

How about this:
https://youtu.be/WA0SKIdhECs

Sorry… the thing to focus on in my last post is the “Rotator from Axis and Angle” node. That seems to do what you described in the first post. In this case, it’s adding 1 degree of rotation every tick.

thank you very much indeed for your reply, but I just cant get it working that way!

i made a very simple scenario:
lets say the white cylinder is the new orientation of the other cylinder (with stone material).
so i want to apply an appropriate rotation to that stone cylinder to eventually match the direction of the white one.
the stone cylinder has currently no rotation so it is upright initially.

i have attached the scene components, blueprints, and the result of the rotation to see what is going on

Shayan

If you have the angle that you want to achieve, you can plug it into a Rinterp node (or lerp rotation) and glide there at a set speed.

can the pivot that comes with importing a static mesh model be changed in blueprint, so e.g. the rotation components use the new one? is there a way to display the new pivot in UE ?