Get object's rotation around axis defined by vector


I have a vector going in the direction from point A to point B.
At the end of point B, I have a gameobject that might rotate in any direction. I’m interested in getting a float value that describes only its rotation/roll around the axis created by the vector.

Imagine it like a straight arm and a hand at the end. The hand can bend up/down or side-to-side, but only when you roll it will the arm roll with it too. I’m interested in getting the arm’s rotation.

Is this possible, and how?

Not really possible. The main issue is that with only rotations around two axis you can implicitly rotate around the third in 3d space. A common example is imagine you are interested on the rotation around the z axis. If you rotate the object 180° on X and 180° on y you essentially have a rotation that is equal to (0, 0, 180). since this rotation process can be a transition, which portion would you consider being part of which axis.

What do you need this rotation angle for? What you might be interested in is having the object being a child of your “arm”. In that case the object’s rotation is defined inside the local space of the arm. Though since you want to rotate the object freely there’s no fix kinematic chain you can refer to. So you need some kind of reference system inside your arm. Keep in mind that this is similar to the real life situation you described. You can freely rotate the object in your hand and grab it in a different way. So the object’s absolute rotation can be anything in relation to your hand or arm.

@Azumikkel, it may not be possible as @Bunny83 notes, but it depends on exactly what you mean.

This statement of yours is a bit ambiguous: “The hand can bend up/down or side-to-side, but only when you roll it will the arm roll with it too.” Because people can bend their hand at the wrist, up and down and side to side both with and without rolling their arm.

As noted, there could be an infinite number of possible arm rotations.

If you have constrained the rotations in a particular way, it might be possible to come up with the rotation of the arm.

Can you provide a diagram that more explicitly details the situation?