Hi all,
I have only stuff going on on the YZ-Plane and I am looking on it with an isometric view along the X-Axis.
When using a pan-tool, the user moves the screen according to the mouse position by grabbing and dragging the screen. I want this for my app.
My approach so far was the following method:
- Calculate view volume width and height in quants
- get mouse movement through mouse_force.x/.y
- take the ratio of mouse_force to screen_size and multiply it with the view volume width/height
- add this to camera.x
Here is my code:
double width = screen_size.x * 2 * tan(camera.arc/2); // From manual
double height = screen_size.y * 2 * tan(camera.arc/2); // Unsure, if this is right
// Calculate movement on Y/Z plane
VECTOR* m = vector(0, (mouse_force.x / screen_size.x) * width, (mouse_force.y / screen_size.y) * height);
vec_scale(m, -1); // Inverse movement to simulate grabbing
vec_add(camera.x, m);
This doesn't work.
Does somebody recognize my error or am I doing everything wrong?
Bye,
Christian