Camera Jumps in orientation
-
In my application, it is traditional for the y axis to be up, with the z axis horizontal along the centerline of a long particle accelerator; x is horizontal to the beam left. I would like to display the world in that orientation; for a side view (looking from the -x axis toward the origin with y up and z to the right):
Sketchup.active_model.active_view.camera.set([-1,0,0],[0,0,0],[0,1,0]) Sketchup.active_model.active_view.zoom_extents
This works fine. But when I use the middle button of the mouse to rotate the display, it immediately jumps so the z-axis is up, and then continues rotating with the mouse.
This is ugly and highly annoying. Is there any way to disable this behavior so it rotates smoothly from wherever the camera is located?
-
I think you can change the model axes to align how you are wanting. Try this, right click on the model axis and choose "Place". Then, to set the axis how you are looking to do, click 1st on the model origin, click 2nd on the negative red axis, click 3rd upwards on the blue axis. That should now realign the axis so that red is to the left, green is up and blue is straight ahead.
I don't think there is a way to set that via ruby. But I think you could essentially include an empty "template" model that has its axis already aligned like that. And you could load that model when the user activates your plugin? That sounds really problematic though....
I suppose you could also code your own camera view tools that disregard the z=up preference of SU? I"m not sure about that really either though.
Try setting it manually though, I'm interested to see if that is even the orientation you are looking for.
Chris
-
@chris fullmer said:
I think you can change the model axes to align how you are wanting. Try this, right click on the model axis and choose "Place". Then, to set the axis how you are looking to do, click 1st on the model origin, click 2nd on the negative red axis, click 3rd upwards on the blue axis. That should now realign the axis so that red is to the left, green is up and blue is straight ahead.
That is funky to use, but it seems to just re-color the axes. The system did not rotate, which it would do if the (new) blue axis was still the z axis.
I made a lucky guess, and found that on my Mac, pushing Option while dragging with the middle mouse button avoids the jumping and rotates smoothly from the current orientation of the axes. I don't know if pushing Alt does this on Windows.
Is there any way I can "push" the option key for my user?
-
It actually re-orients the model's axis. So green is up and blue is shooting straight forward, like you asked for.
You can write your own camera positioning tool and you can program it's "up" direction to be pointing any which way you want. But as soon as the user flips back to the built-in orbit tool, SU will default back to forcing the original model axis z, to be up. SU very strongly favors having the z axis not tilt left or right.
Advertisement