Friday, July 6, 2007

Autofields working with shapes for activation

I've recently finished enabling activation of fields by collision. Of course, this requires that both the field and any bodies it must effect. Fields with no shape apply to all bodies in the scene, as before. Here's an example, available in the tests directory as
from time import sleep
import soy
sce = soy.Scene()
cam = soy.bodies.Camera(sce)
cam.position = (0,0,13)
py1 = soy.bodies.Pyramid(sce)
py1.position = (-2,0,0)
py1.shape = soy.shapes.Sphere(1)
py1.velocity = (0,0.7,0)
py2 = soy.bodies.Pyramid(sce)
py2.position = (0,0,0)
py2.shape = soy.shapes.Sphere(1)
py2.velocity = (0,0.7,0)
py3 = soy.bodies.Pyramid(sce)
py3.position = (2,0,0)
py3.shape = soy.shapes.Sphere(1)
py3.velocity = (0,0.7,0)
scr = soy.Screen()
win = soy.Window(scr, size=(640,480))
pro = soy.widgets.Projector(win, size=(640,480), camera=cam)
m = soy.bodies.fields.Monopole(sce)

You should notice the pyramids being repelled by interesecting an invisible sphere.

1 comment:

Pedro Luz said...


I've tryed that code... but grrr no luck :P

Traceback (most recent call last):
File "", line 16, in module
TypeError: 'tuple' object is not callable