hello every body
i rewrote my game into pure opengl and pygame
i have finished things like camera movement and other stuff.
Now i really need help with the collision
it basicly works even if the box/objekt is resized but now i want it to work when the objekt/box is rotated
here is the collision funktion
def Collision(self): self.event_handler() # get the event/movement camx, camy, camz = self.cam_pos for (posx, posy, posz), (scalex, scaley, scalez), (rotx, roty, rotz) in self.Coll_list: # get the values of the objekt xdist = -camx - posx+scalex zdist = camz + posz+scalez if xdist > -0.3 and xdist < scalex*2+0.3 and zdist > -0.3 and zdist < scalez*2+0.3: if xdist < 0: self.cam_pos[0]=posx-(scalex-(scalex*2-1.7)) elif xdist > scalex*2: self.cam_pos[0]=posx-(scalex+2.3) elif zdist < 0: self.cam_pos[2]=-posz-(scalez+scalez*2-1.7) elif zdist > scalez*2: self.cam_pos[2]=-posz-(scalez-2.3)
the code looks wrong on this site so look here if you wouldnt be able to read it
the way it works is that it takes the distance between the box and the player/camera and checks if its over a special value
here is the full source if you would want to try it
it only needs opengl and pygame nothing else
please would appreciate if you would try to help me