Documentation Index | From module rabbyt.physics.

Basic2

Basic2(xy=(0,0), vxy=(0,0), axy=(0,0), ...)

I am planning on taking this class out in the next version of rabbyt. If you want it to stay, drop me an email explaining why and I might change my mind.

(You can also use the single value properties as keyword arguments, if you prefer.)

This is a convenience class for using two Basic1 instances to simulate physics in two dimensions.

Using item access will return the individual Basic1 instances, so this would work fine:

sprite.xy = Basic2((0,10), axy=(0,-9.81))

You can set the positions, velocities, and accelerations for x and y with the properties x, y, vx, vy, ax, and ay.

You can also assign/retrieve two value at once with xy, vxy, or axy.

Any of these properties can be passed to __init__() as keyword arguments.

Basic2 instances are not automatically added to rabbyt.physics.default_update_manager, but the individual Basic1 instances used for each dimension are. (Adding the Basic2 instance as well would result in the Basic1 instances being updated twice!)

Methods

update

Properties

ax

x acceleration

axy

x and y accelerations

ay

y acceleration

vx

x velocity

vxy

x and y velocities

vy

y velocity

x

x position

xy

x and y positions

y

y position