roncresswell
Community Member

Posts: 6
|
 |
« on: March 07, 2010, 11:55:06 PM » |
|
I'm trying (for my first delve into TV3D) to create myself a 3D modeller. What I want to be able to do is to keep my mesh fixed in space (because the node coordinates are absolute) and move the camera around to look at the model from different viewpoints.
So, it appears as if this question comes up relatively often, and the Arcball approach is the most intuitive from the users point of view for rotating the view around the model.
That's fine, but any implementation I have seen appears to be for rotating the model rather than the mesh. And applying an arcball rotation to the camera position instead produces an unwanted effect as the viewpoint passes over the "north pole". Namely the camera model seems to have it's own logic to determine which way is "Up", and produces a sudden "roll" at this point. The "roll" angle is unspecified if you simply set the Look-At and Look-From points, which I presume is why the camera seems to control this itself.
However, if I were to rotate the mesh rather than the camera, there would be no unspecified rotations, and because the camera's orientation in world coordinates is fixed, there would be no unexpected roll of the view.
Is there a way, to anyone's knowledge, of doing what I want to do? As far as I can see there are two possible ways of achieving this:
1. Give in and rotate the mesh, but keep a global variable which is the rotation quaternion required to put the mesh back into "real world" coordinates for export;
2. Constantly correct the roll of the camera as it is moved, such as:- a. Get the basis vectors of the camera, b. add them to the camera position vector to get their location in global coordinates, c. apply the arcball rotation to all 4 vectors (camera position, up, right and front vectors) d. Subtract the new camera position from the transformed basis vectors (to get them back into local coordinates) e. get the new basis vectors f. calculate the angle between the transformed "Up" vector and the one returned by the camera g. rotate the camera by this angle
Does this sound feasible or am I somehow making things hard for myself?
|