Author: DavidCzech Date: 2008-02-23 22:10:01 -0500 (Sat, 23 Feb 2008) New Revision: 972
Modified: trunk/pysoy/src/scenes/Planar.pxi trunk/pysoy/src/scenes/soy.scenes.pxd Log: Offset in gravity property Modified: trunk/pysoy/src/scenes/Planar.pxi =================================================================== --- trunk/pysoy/src/scenes/Planar.pxi 2008-02-23 05:15:44 UTC (rev 971) +++ trunk/pysoy/src/scenes/Planar.pxi 2008-02-24 03:10:01 UTC (rev 972) @@ -38,8 +38,9 @@ # the ``motionless'' body and then resetting it's position/orientation on # each time step. This can cause unexpected simulation errors. - def __cinit__(self, *args, **kw) : - self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, 0.0) + def __cinit__(self,offset=0, *args, **kw) : + self._offset = offset + self._planeID = ode.dCreatePlane(self._spaceID, 0.0, 1.0, 0.0, self._offset) ode.dGeomSetCategoryBits(self._planeID,GeomScene) ode.dGeomSetData(self._planeID, <void*> self) @@ -52,14 +53,23 @@ cdef void _coreRender(self) : Scene._coreRender(self) - gl.glBegin(gl.GL_TRIANGLE_STRIP) + #gl.glDisable(gl.GL_DEPTH_BUFFER) + #gl.glBegin(gl.GL_TRIANGLE_STRIP) #gl.glNormal3f(0, 1, 0) - gl.glVertex3f(1,0,0) - gl.glVertex3f(-1,0,0) - gl.glVertex3f(0,0,-1) - gl.glVertex3f(0,0,1) - gl.glVertex3f(1,0,0) - gl.glEnd() + #gl.glTranslatef(0,<int>step,0) + #stdio.printf("someting2\n") + #gl.glVertex3f(0,0,-1) + #gl.glVertex3f(0,0,1) + #gl.glVertex3f(1,0,0) + #stdio.printf("someting3\n") + #gl.glVertex3f(0,0,0) + #gl.glVertex3f(1,1,0) + #gl.glVertex3f(1,-1,0) + #stdio.printf("igot here!") + + #gl.glVertex3f(1,0,0) + #gl.glEnd() + #gl.glEnable(gl.GL_DEPTH_BUFFER) property gravity : '''Scene gravity @@ -79,9 +89,14 @@ normal[0] = -(value[0]) normal[1] = -(value[1]) normal[2] = -(value[2]) + if len(value) == 4: + stdio.printf("4 Values! using the fourth one as offset") + print value[3] + self._offset = value[3] ode.dGeomDestroy(self._planeID) - self._planeID = ode.dCreatePlane(self._spaceID, normal[0],normal[1],normal[2], 0.0) + ode.dNormalize3(normal) + self._planeID = ode.dCreatePlane(self._spaceID, normal[0],normal[1],normal[2], self._offset) ode.dGeomSetCategoryBits(self._planeID,GeomScene) ode.dGeomSetData(self._planeID, <void*> self) - ode.dNormalize3(normal) + ode.dWorldSetGravity(self._worldID, value[0], value[1], value[2]) Modified: trunk/pysoy/src/scenes/soy.scenes.pxd =================================================================== --- trunk/pysoy/src/scenes/soy.scenes.pxd 2008-02-23 05:15:44 UTC (rev 971) +++ trunk/pysoy/src/scenes/soy.scenes.pxd 2008-02-24 03:10:01 UTC (rev 972) @@ -56,3 +56,4 @@ cdef class Planar (Scene) : cdef ode.dGeomID _planeID + cdef int _offset _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn