From: Aaron M. <mav...@gm...> - 2010-09-10 20:19:36
|
Hi, I have an application which requires me to view a scene from a particular point in space (pointed along a particular axis). Suppose I want the camera at point (a, b, c), pointed at (d, e, f). This may occur at any point in the program -- i.e., I want the ability to rotate and zoom the scene freely before jumping into this view. First, I set display.center = (d, e, f). Then, I set display.forward to something like (d, e, f) - (a, b, c). This gives me the correct axis, but the actual position of the camera along that axis (i.e. the "zoom" level, or range/scale) is incorrect, and appears somehow linked to whatever my range/scale was before I switched to that view. >From what I understand, the magnitude of display.forward ought to put the camera at the appropriate distance from display.center. I also tried explicitly setting display.range, based on a complex set of calculations involving the relative position of the center and the field of view, and while I am somewhat encouraged that this gives me the same result as the simpler solution above, it's still not the correct result. I suspect, if I am not misunderstanding something, that there may be some issue with how Visual is storing the current position when the user rotates and zooms with the mouse. Take the following short program: import visual visual.box() while True: visual.rate(50) if visual.scene.kb.keys: k = visual.scene.kb.getkey() if k == 'f': visual.scene.range = 5 elif k == 'g': visual.scene.range = 3 Running this gives the following results: F - the box zooms out to size A G - the box zooms in a bit, to size B F - the box zooms out, back to size A <mouse zoom> - the box zooms out to size C F - the box remains at size C G - the box zooms in a bit, to size D (!= B) F - the box zooms out, back to size C I would have expected from the documentation that, assuming the only mouse interaction is zooming, hitting F again should return the box to size A -- in other words, that the range/scale is absolute. If this is buggy behavior, is there a fix or workaround? If this is the expected behavior, how can I achieve what I am trying to do above? -- Aaron Mavrinac www.mavrinac.com PGP Public Key: http://www.mavrinac.com/pgp.asc |