Hi,

I'm just about finished my first, simple b2cs python project. It's a
worms-style game. Everything I need is in place except for a menu and
collision detection. I haven't been able to get collision detection
working in my behaviour for the cannon ball in the game. Here's the
relevant part of the python behaviour:

        def pctimer_wakeupframe(self, pc, args):
                
                if self.moving:
                        elapsed = 
args.GetParameter(parid("elapsedticks"))/1000.0
                        mesh = celGetMesh(self.entity)
                        curPos = mesh.Mesh.GetMovable().GetPosition()
                        startPos = curPos

                        #movement
                        self.vel[1]+= elapsed*self.GRAVITY
                        curPos[0] = curPos[0]+self.vel[0]
                        curPos[1] = curPos[1]+self.vel[1]
                        curPos[2] = curPos[2]+self.vel[2]
                        
                        #collision detection
                        hit =
mesh.Mesh.GetMovable().GetSectors()[0].HitBeamPortals(startPos,curPos)
                        if str(hit.mesh) != "None":
                                self.log(hit.mesh)
                        if hit and Clock.GetCurrentTicks() - self.firedTime >
self.liveRoundDelay and hit.mesh: #todo: mesh isn't being set. Am I
missing some initialization step?
                                self.log(hit.mesh)
                                self.log("Pow!")
                                self.moving = 0
                                
                        mesh.MoveMesh(mesh.Mesh.GetMovable().GetSectors()[0], 
curPos)
                        

hit.mesh is always "None". Is there some initialization I need to do? If
so, can someone point me to some sample code or the relevant docs?

Thanks,

TF


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Cel-main mailing list
Cel-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cel-main

Reply via email to