As I haven't posted anything in awhile either, after seeing Arc's post I figure it's time to let everyone know how things are.
First, welcome to team PySoy, Kirk and Derek! Derek's done some good texture work with video decoding and Cairo for text, and Kirk has recently been pushing very hard towards a working Windows build! Thanks for your work, it really is appreciated.
So, why haven't I been doing much recently? Well, I'm back at school, working towards my Master's in CS, which tends to use up a lot of time. I've got some ideas knocking around in the back of my head, though... there might be some code for encapsulating surface behaviour for collisions sometime in the next decade or so.
I'd love to see input handling working sometime soon as well.
Tuesday, October 2, 2007
Sunday, August 19, 2007
soy.bodies.fields.Bouyancy
Over the last week, I've done quite a bit of work on bouyancy. It's an interesting problem, one that always appears simpler than it really is. The basic concept, that gravity (i.e. soy.bodies.fields.Monopole) effects bodies based on their mass minus their displacement, is deceptively concise.
First, you have to find a way to calculate all the displacements before you try to do gravity calculations. In this case, it required moving the gravity calculations into _commit() and adding action list population to _exert(). This allowed me to leave the displacement math in Bouyancy, storing the information in the bmass tag on effected bodies. However, this leaves yet another problem; all those tags are getting set, but nothing is out there unsetting them. Thankfully, we have Bouyancy._give() to the rescue, ready to clear up all those pesky tags in the cycles where Bouyancy is going to be repopulating them.
Unfortunately, our deceptively simple problem isn't done with us yet. We still don't have a good way to actually calculate displacement. As ODE doesn't have support for this, we have to write an approximation of sorts, and whichever way we do it, some cases are going to lose out. I settled on using pointDepth and a generalized Shape._radius() fuction to estimate how much of the shape of the body was within the Bouyancy field, but I welcome any input on improvements.
First, you have to find a way to calculate all the displacements before you try to do gravity calculations. In this case, it required moving the gravity calculations into _commit() and adding action list population to _exert(). This allowed me to leave the displacement math in Bouyancy, storing the information in the bmass tag on effected bodies. However, this leaves yet another problem; all those tags are getting set, but nothing is out there unsetting them. Thankfully, we have Bouyancy._give() to the rescue, ready to clear up all those pesky tags in the cycles where Bouyancy is going to be repopulating them.
Unfortunately, our deceptively simple problem isn't done with us yet. We still don't have a good way to actually calculate displacement. As ODE doesn't have support for this, we have to write an approximation of sorts, and whichever way we do it, some cases are going to lose out. I settled on using pointDepth and a generalized Shape._radius() fuction to estimate how much of the shape of the body was within the Bouyancy field, but I welcome any input on improvements.
Wednesday, August 8, 2007
Wind in my sails
While things have been pretty quiet recently, I've been getting things done, albeit to an empty theater. There are now several field types that work. While building them, I've added several features to the field system. There are now four functions that can be either defined or not:
- int _apply()
- This function performs the field activation for universal fields (fields not confined to one area).
- int _exert(other)
- This function is called when a field must be applied to a body it effects. Its return value indicates whether exertion was final (i.e. does not need _commit() to be called).
- void _give(mode)
- At the beginning of each field cycle, this function is called. As for mode, 1 means we're in a physics cycle, 0 means we're in a universal cycle.
- void _commit()
- At the end of each physics cycle, this function is called if _exert ever returned 0 (for non-completeness). In the non-collide physics cycle (for universal fields), the Field._apply() function performs a vital part here - careful while overriding it.
Sunday, July 8, 2007
Beta-1, here we come
I've finished my milestones for the first beta; all the placeable shapes are there, autofields of both varieties work, and bodies have arbitrary tags that will have some utility later. I may be doing various other work before the beta, but I've pretty much got it all under wraps.
Break out the champagne!
Break out the champagne!
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 collide_field.py.
You should notice the pyramids being repelled by interesecting an invisible sphere.
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)
m.position=(3,4.8,0)
m.shape=soy.shapes.Sphere(4.4)
m.multiplier=4
You should notice the pyramids being repelled by interesecting an invisible sphere.
Saturday, June 23, 2007
Autofields!
I haven't posted much yet. This is because there hasn't been much to show off yet. Now, there is. I've got fields working automatically from coreloop. Here's an example....
Edit: updated example to avoid warning
import soyI haven't got around to normalizing the acceleration based on the timestep, but it's coming.
sce = soy.Scene()
cam = soy.bodies.Camera(sce)
cam.position = (0,0,10)
py1 = soy.bodies.Pyramid(sce)
py1.position = (-2,0,0)
py2 = soy.bodies.Pyramid(sce)
py2.position = (0,0,0)
py3 = soy.bodies.Pyramid(sce)
py3.position = (2,0,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)
m.position=(-1.5,3,0)
m.multiplier=-2
Edit: updated example to avoid warning
Sunday, June 3, 2007
ODE to joy
Today I familiarized myself with a good portion of the code and I've made the first step towards my actual project - working ODE code. It's only a test routine to nudge a body slightly, but now I know how to add ODE functions & use them on bodies. This week is going to be far more productive than last week was.
Subscribe to:
Posts (Atom)