June 2025
Intermediate to advanced
515 pages
17h 5m
English
The main purpose of an animation is to move bodies. As in the real world, the body objects created using VPython methods should be able to move through 3D space in accordance with the laws of physics. All mathematical operations of location changes usually run within an infinite loop, which I also refer to as an animation loop in the further course of this book. You can use the rate(frequency) method to set how often the animation should be executed in 1 second. The body.pos=vector(x,y,z) property sets the current position of the body in 3D space.
For a vertical movement, the x and z components of the 3D coordinates have the value zero. The body.v=vector(0,0,0) property initializes the velocity ...
Read now
Unlock full access