[Edu-sig] Python Physics Sandbox released

Jay Shaffstall jshaffstall at gmail.com
Wed Dec 14 13:54:04 EST 2016


Hi Eric,

Glad the sandbox is working for you!

You've got a couple of options for giving the ball a horizontal velocity,
depending on what effect you want.

If you want an instantaneous horizontal kick, but after that the ball
responds normally to gravity, use b1.hit and set the y part of the
direction tuple to 0.

If you want the ball to fall horizontally use b1.gravity and again set the
y part of the gravity to 0.

If what you're looking for is a constant velocity, there isn't any way to
do that right now, but you might play with the ball's gravity and damping
values to see if you can get the right effect.

This is just a first version, so if you see features you'd like, let me
know.

Take care,
Jay

On Wed, Dec 14, 2016 at 10:40 AM, Eric Matthes <ehmatthes at gmail.com> wrote:

> Hi,
>
> This looks great, and I hadn't seen pymunk before. I tried a quick
> simulation, and it's working:
>
> import pyphysicssandbox as ps
> ps.window("ball", 600, 400)
>
> b1 = ps.ball((100, 0), 30)
> ps.run()
>
> How do I give the ball a horizontal velocity?
>
> Eric
>
>
>
> On Tue, Dec 13, 2016 at 5:46 AM, Jay Shaffstall <jshaffstall at gmail.com>
> wrote:
>
>> I'm very pleased to announce the general release of a Python physics
>> sandbox targeting students in intro programming courses.  We teach Python
>> as a first language here and a physics simulation has long been one of the
>> students' favorite labs.  But the simulation we were using, while easy to
>> use, was pretty limited and only worked in one particular IDE.
>>
>> So I wrote PyPhysicsSandbox, a thin wrapper around pymunk.  The sandbox
>> allows students to construct more sophisticated combinations of shapes and
>> joints and interactivity with the user.  It should also work in any
>> environment that allows installing libraries to Python using pip.
>>
>> The code lives here: https://github.com/jshaffstall/PyPhysicsSandbox
>>
>> It's freely available for use in your own classes.
>>
>> Jay
>>
>> _______________________________________________
>> Edu-sig mailing list
>> Edu-sig at python.org
>> https://mail.python.org/mailman/listinfo/edu-sig
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20161214/1ee7832b/attachment.html>


More information about the Edu-sig mailing list