Basic1(p=0, v=0, a=0)
Provides basic physics (position, velocity, and acceleration,) in a single dimension.
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.
Basic1 instances can be used as anims, so you can do this for example:
sprite.y = Basic1(10, a=-9.81)
(The sprite will start at a height of ten, then fall with an acceleration of -9.81 world units per second.)
Uppon creation, a Basic1 instance will automatically add itself to the global update manager. This frees you from having to keep track of it yourself. Just use rabbyt.physics.update(dt) to update everything.
get() -> float
Gets the value.
update(dt)
Update the state by timestep dt.
By convention, I recommend using a timestep measured in seconds, rather than in milliseconds.
acceleration
This property accepts anims. For example, if you want to ramp up acceleration:
basic_physics.a = rabbyt.lerp(0,100, dt=1000)
position
velocity