How to replicate 2-hand rotation like Tiltbrush?

236 Views Asked by At

So im trying to make a two-hand VR rotation mechanic, where the user grabs an object with one hand, and then with the other hand is able to rotate the object around a pivot point. That pivot point is gonna be a weighted point along the line between the two motion controllers closest to the one that is kept most still. The rotation should appear natural. I realize this is a bit hard to explain, so with reference in Google Tiltbrush, i recorded a video showing how i want it to behave: Tiltbrush rotation

Im interrested in the math behind doing such a rotationmechanic so i can replicate it myself in UE4.

I've created a video showing a preliminary result i got, but where i don't have any control over pivot point (which is the center of the object) and the object snaps to a forward direction relative to the 2nd hand grabbing: My current attempt

I wanna also say that im not too strong in math, so i rely highly on the math functions available in UE4. When that's said, im prepared to have to figure out how to convert the matrixtransformations into whatever i need to use in UE4, as long as i understand the logic necessary to get the desired behavior.

So i suppose the problem i want to try solve, is a way to get a lookat-rotation that doesn't suffer from any singularity/gimbal lock related issues at any angles, and rotate around a dynamic pivot point. And rotate relative to it's current location (so it rotates from it's current rotation when the 2nd hand grabs).

Any constructive input will be welcome. Thanks.