From: Jonathan B. <jbr...@ea...> - 2004-05-14 12:53:48
|
On Fri, 2004-05-14 at 06:04, Zbigniew wrote: caveat, I haven't looked at any of your code. > 3. > The collision detection is done with > the pos field. The rotations of the > playfield are 90 degree (split in > phases to animate). > Pos coordinates of the boxes are used > to detect collisions and should be > integer numbers > (I assumed that 90 degree rotations transform > integer into integer). This is probably not a valid assumption if you are using the built-in rotate() function. > I'm aware of the floats during roations therefore > I do float->int conversion. > I do it but sometimes the snake runs through > the green box and collision is not detected. > Code looks ok. Thats the major problem > I cannot solve and I came here with. All vectors are always floating-point values in VPython. If you need to truncate the precision to an integer type, you will probably need to write your own round-to-nearest conversion routine since Python only directly supports truncation of the decimal part. See math.modf() for some help here. > 2. Is there chance for bitmap graphics support > (I imagine it as a layer on the top of the 3d display). > That would be also useful for teaching of the computer > graphics (drawing lines, filtering images etc.) VPython doesn't support anything in screen coordinates except for portions of the text object. I'm doing some experiments with OpenGL textures that may yield fruit in this area, but its way too early to tell right now. HTH, Jonathan Brandmeyer |