Author: DavidCzech Date: 2008-02-22 20:38:24 -0500 (Fri, 22 Feb 2008) New Revision: 967
Modified: trunk/pysoy/src/scenes/Planar.pxi Log: Inverse Gravity Normal work Modified: trunk/pysoy/src/scenes/Planar.pxi =================================================================== --- trunk/pysoy/src/scenes/Planar.pxi 2008-02-23 01:12:07 UTC (rev 966) +++ trunk/pysoy/src/scenes/Planar.pxi 2008-02-23 01:38:24 UTC (rev 967) @@ -16,9 +16,8 @@ # along with this program; if not, see http://www.gnu.org/licenses # # $Id$ - DEF GeomScene = 1 -DEF GeomBody = 2 +DEF GeomBody = 2 DEF GeomField = 4 DEF GeomLight = 8 @@ -41,19 +40,16 @@ def __cinit__(self, *args, **kw) : self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, 0.0) - #self._planeID = ode.dCreateBox(self._spaceID, 0.1, 0.1, 0.1) - ode.dGeomSetCategoryBits(self._planeID, GeomScene) - #ode.dGeomSetCollideBits(self._planeID, GeomBody) + ode.dGeomSetCategoryBits(self._planeID,GeomScene) ode.dGeomSetData(self._planeID, <void*> self) - stdio.printf('%d\n', ode.dGeomGetSpace(self._planeID)) - stdio.printf("%d\n",ode.dGeomGetCategoryBits(self._planeID)) - stdio.printf("asdf\n") + stdio.printf("Catergory bits%d\n",ode.dGeomGetCategoryBits(self._planeID)) + stdio.printf("Screen Creation Done") def __delalloc__(self) : ode.dGeomDestroy(self._planeID) - ''' + cdef void _coreRender(self) : Scene._coreRender(self) gl.glBegin(gl.GL_TRIANGLE_STRIP) @@ -65,4 +61,27 @@ gl.glVertex3f(1,0,0) gl.glEnd() - ''' + property gravity : + '''Scene gravity + + This is a scene-wide pseudo-force drawing all bodies in a single + direction. This should not be confused with a monopole force or other + forces which are often used for gravity in larger scenes. + + Takes a (x,y,z) tuple of numbers, defaults to (0.0, 0.0, 0.0) + ''' + def __get__(self) : + cdef ode.dVector3 grav + ode.dWorldGetGravity(self._worldID, grav) + return (grav[0], grav[1], grav[2]) + def __set__(self, value) : + cdef ode.dVector3 normal + normal[0] = -(value[0]) + normal[1] = -(value[1]) + normal[2] = -(value[2]) + ode.dGeomDestroy(self._planeID) + self._planeID = ode.dCreatePlane(self._spaceID, normal[0],normal[1],normal[2], 0.0) + ode.dGeomSetCategoryBits(self._planeID,GeomScene) + ode.dGeomSetData(self._planeID, <void*> self) + ode.dNormalize3(normal) + ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2]) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn