Hello, if you guys can help me, I would be really happy.
I have VR pawn attached to boat using socket on boat, so Pawn has fixed location relative to boat (boat is going along the river and user with HMD is sitting) and I need to calculate Yaw, Pitch, Roll angle of VR camera. Basically when you are looking straight ahead, rotation is 0,0,0. When looking 45 degrees left, it´s 0,0,-45, when 45 degrees left and up, it should be 0,45,-45… etc.
I have blueprint, which is calculating this correctly, when looking only left/right or up/down, but when looking left+up (those 45 degrees), result is starting to be weird, I´m getting for example 0,34,-45 instead of 0,45,-45 (Pitch value is decreasing the more I´m looking left). I´m attaching my Blueprint, which is doing this weird result.
To calculate this, I´m using socket location, where my Pawn is attached, with 2,5 meters offset from camera to have it on the front edge of my boat (height is same as camera). So when I´m looking straight ahead, I´m getting 0,0,0 camera rotation and results, which i described above. I also tried solutions with dot product, but had weird results too, when calculating all three values.
On top of that, I have no idea, how to calculate Roll angle. With my solution, it´s of course always zero. When I tried dot product of up vector of camera and socket, it was working correctly when looking straight ahead and tilting my head, but when looking somewhere alse, all values influenced others in a weird way.
Hopefully my explanation is clear. Thanks a lot. I will appeciate every help (Blueprints only).