Help needed for Collision Detection

I am having a problem with collision detection between two objects.
a ball moving towards a wall. When it collides with the wall nothing happens. Collision was not detected. I am getting only the following in the command line.

:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already accepting: into-Rwall
:11-10-2006 17:40:24 Messenger(warning): object: World already
"world already accepting: into-Rwall.

collision response is not printed. It seems that the function Rwall colliding is not recognised.
The Source:
from pandac.PandaModules import ConfigVariableBool
from pandac.PandaModules import ConfigVariableInt
ConfigVariableBool(“fullscreen”).setValue(1)
import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import *
from direct.showbase.DirectObject import *
from math import sin, cos, pi
from random import randint, choice, random
from direct.gui.OnscreenText import OnscreenText
import sys,os
from pandac.PandaModules import Filename

get the location of the ‘py’ file I’m running:

#def loadTextures(self):

class World(DirectObject):
def init(self):
self.mydir = os.path.abspath(sys.path[0])
#convert that to panda’s unix-style notation
self.mydir = Filename.fromOsSpecific(self.mydir).getFullpath()
#model = loader.loadModel(mydir + “/models/mymodel.egg”)
#The standard camera position and background initialization
wp = WindowProperties()
wp.setFullscreen(True)
base.win.requestProperties(wp)
wp.setCursorHidden(1)
base.win.requestProperties(wp)
base.setBackgroundColor(0, 0, 0)
base.disableMouse()
camera.setPos ( 0, 0, 0 )
# camera.setHpr ( 0, -90, 0 )
self.coln = 0
base.disableMouse()
self.loadModels()
self.px = 0.03
self.gameTask = taskMgr.add(self.move, “move”)
self.gameTask.last = 0
self.accept(“escape”, sys.exit) #Exit the program when escape is pressed
self.hitscreen = loader.loadSfx(self.mydir + “/HITSCR.WAV”)

#end __init__     

def loadModels(self):
myT = loader.loadTexture(self.mydir + “/models/fire.jpg”)
myT1 = loader.loadTexture(self.mydir + “/models/stone.jpg”)

 self.ball3 = loader.loadModelCopy(self.mydir + "/models/ball3")
 self.ball3.reparentTo(render)
 self.ball3.setTexGen(TextureStage.getDefault(),TexGenAttrib.MWorldPosition)     
 self.ball3.setTexture(myT1)
 self.ball3.setPos(-1.5,11,0)
 
 self.Rwall = loader.loadModelCopy(self.mydir + "/models/box4")
 self.Rwall.reparentTo(render)
 self.Rwall.setScale(.1,6,4)
 self.Rwall.setTexGen(TextureStage.getDefault(),                                TexGenAttrib.MWorldPosition)
 self.Rwall.setTexture(myT1)
 self.Rwall.setPos(1,11,0)
 
#end loadModels

def move(self, task):
if task.time >0:
self.ball3.setX(self.ball3.getX() + self.px)
self.setcoln()
return Task.cont
#end moveball
def setcoln(self):

    self.cHandler = CollisionHandlerEvent()        
    self.cTrav = CollisionTraverser()
    base.cTrav = self.cTrav
    self.cHandler.addInPattern('into-%in')        
    self.collEntry = CollisionEntry
   
    bounds = self.ball3.getChild(0).getBounds()
    center = bounds.getCenter()
    radius = bounds.getRadius()                                      
    ball3Node = CollisionNode("ball3")
    ball3Node.addSolid(CollisionSphere(center, radius))
    ball3NodePath = self.ball3.attachNewNode(ball3Node)        
    self.cTrav.addCollider(ball3NodePath,self.cHandler)
    ball3NodePath.show()

    bounds = self.Rwall.getChild(0).getBounds()
    center = bounds.getCenter()
    radius = bounds.getRadius()                                      
    RwallNode = CollisionNode("ball3")
    RwallNode.addSolid(CollisionSphere(center, radius))
    RwallNodePath = self.Rwall.attachNewNode(RwallNode)        
    self.cTrav.addCollider(RwallNodePath,self.cHandler)

RwallNodePath.show()

    self.accept('into-Rwall', self.RwallColliding)        
# end setupCollisions

def RwallColliding(self, CEntry):
self.coln = 1
print “collided”
hitscreen.play()

#end class world
w = World()
run()

Please let me know where is the problem.

leo

It might be helpful to do the following:

messenger.toggleVerbose()

This enables the message-sender’s ‘verbose’ mode, which will tell you if any messages are being sent. It’s possible the message is not ‘into-Rwall.’

Additionally, I don’t see where you set your from collide mask and your into collide mask. Check the manual for more information on these; the summary is that the from object’s “from” collide mask must overlap the into object’s “into” collide mask.

(One other thing: since Python is a whitespace-significant language, you may want to paste future code examples between the “[code ] [/code ]” tags. These preserve space and make the example much easier to read)

Let us know if you need more help!

Take care,
Mark