Attempting to control orthorgraphic camera position (x,y,z) and up vector (top of camera) from euler angles.
I have a real world device with an IMU that outputs rotation along each axis (x,y,z). I'm trying to translate these angles into camera eye position and up vector direction. If the physical device is altered, the change in orientation should be reflected in the change in position of the camera.
I'm having a hard time with the math behind this mapping, and have not had a ton of luck in what I've attempted. I can get single axis rotations to work but multiple axes has been a problem. Any help in mapping yaw,pitch and roll from physical device onto the position and up vector of camera would be amazing. The math is proving to be quite a problem for me.
The distance from camera to object and target point should remain constant.
radius = camera.target.distanceTo(camera.eye)
pos = get_data()
#convert to radians and cast to float
roll = float(pos['x'])*(math.pi/180.0)
pitch = float(pos['y'])*(math.pi/180.0)
yaw = float(pos['z'])*(math.pi/180.0)
x = camera.eye.x
y = camera.eye.y
z = camera.eye.z
x = x*math.cos(pitch)*math.sin(yaw)
y = y*math.cos(yaw)*math.cos(pitch)
z = z*math.sin(pitch)
eye = Point3D.create(x,y,z)
camera.eye = eye
camera.target = target
camera.upVector = up