|
If you're new to Python Pictures of 3D objects |
Click ExampleThis program displays a box, then repeatedly waits for a mouse left click and displays a cyan sphere at the mouse location. A mouse click is defined as pressing and releasing the left mouse button with no motion of the mouse, so the sphere appears when you release the mouse button. scene.range = 4 Copy this program into an edit window and run the program. Click outside the box and a cyan sphere appears where you click. If you click inside the box, nothing seems to happen. This is because the mouse click is in the xy plane, and the sphere is buried inside the box. If you rotate the scene and then click, you'll see that the spheres go into the new plane parallel to the screen and passing through scene.center. If you want all of the spheres to go into the xy plane, perpendicular to the z axis, change the latter part of the program like this: loc =
evt.project(normal=vector(0,0,1)) |
||