From: Bruce S. <Bru...@nc...> - 2009-07-06 05:39:45
|
Placing the camera in a particular position is not as simple as it probably ought to be. I think the reason that scene.mouse.camera is read-only has to do with synchronizations issues, but I'll admit to being a bit hazy on this issue. Here is a way to place the camera at a specific location, in this case (10,10,10): from visual import * box() d = vector(10,10,10) scene.forward = -norm(d) #scene.fov = pi/3 (the default fov) scene.range = mag(d)*tan(scene.fov/2) print scene.mouse.camera # not updated yet print scene.forward scene.mouse.getclick() print scene.mouse.camera # now shows <10,10,10> The key geometrical point is that scene.fov is the angle subtended by the scene, so the tangent of half of that angle is the range (recall that range=1 means the scene goes from -1 to +1). Bruce Sherwood |