0

I have a standard 3D player camera which can be rotated on the pitch and yaw axes, but not on the roll axis. The rotation order is yaw-pitch-roll.

By default pitch rotates around the x-axis, yaw rotates around the y-axis and roll around the z-axis.

I want the player to be able to walk onto a sloped surface, so that the camera will be relative to that surface afterwards. So, for example, the player can move from the ground plane to a 90 degree wall, after which the wall should 'become' the new ground and the player should be able to rotate the camera relative to the wall as if it was the ground plane. So, let's say in the new coordinate system, pitch rotates around the x-axis, yaw rotates around the z-axis and roll around the y-axis, so yaw and roll have essentially switched their roles.

My problem is, I want to smoothly transition between the two coordinate systems, so that roll is 0 both before and after the transition. Rotation around the roll-axis during the transition is fine (but should be a minimum).

I can work with either euler angles or quaternions. What are my options?

Silverlan
  • 2,783
  • 3
  • 31
  • 66
  • I thought a bit about your problem, and to me what you want is not very clear. Why can't you simply discretize the problem? For example, consider an expected smooth player trajectory going from point A on the ground to point B on the wall, and consider a number N of tangent vectores (regularly spaced) to that curve, and consider these tangents to be the new x axis. That way, you get N different coordinates transforms that are trivial to compute, and you get the smooth effect that you had in mind. – Ash Jul 21 '17 at 21:25
  • You certainly have a few equations in mind, and I think it would really help clarify what you want if you gave them as an example. It would really help clarify what type of answer you are after. General ideas or specific formulas? – Ash Jul 21 '17 at 21:27

0 Answers0