Hello community!
I’m new to the wonderful world of panda3d; we were just introduced two weeks ago. I’ve learned a lot since then. I’m currently having a problem whose solution may be so obvious I’m missing it.
I’ve created a model and animation in blender and successfully exported it (verified by using in the hello panda tutorial). There is a collision sphere built into the model, which I can access when it is loaded as a static model (and verified with another program I wrote).
My problem is trying to access that collision sphere when I load the model with the Actor() command. For example,
#load the ice cube
self.icecube = loader.loadModel("ice_cube2")
##self.icecube = Actor("ice_cube2")
self.icecube.reparentTo(render)
self.icecube.setPos(50,50,0)
self.icecube.setH(-45)
self.icecube.setCollideMask(OFF)
#set up icecube's collision geometry
raygeometry = CollisionRay(0, 0, 2, 0, 0, -1)
icecubeCollider = self.icecube.find("**/ice_box_collider")
icecubeCollider.node().setFromCollideMask(WALL|P2BODY)
icecubeCollider.node().setIntoCollideMask(P1BODY)
icecubeRay = self.icecube.attachNewNode(CollisionNode("icecubeRay"))
icecubeRay.node().addSolid(raygeometry)
icecubeRay.node().setFromCollideMask(FLOOR)
icecubeRay.node().setIntoCollideMask(OFF)
works just fine with a static model with collision geometry, but
#load the ice cube
self.icecube = Actor("ice_cube2", {"walk": "ice_cube2-walk"})
self.icecube.reparentTo(render)
self.icecube.setPos(50,50,0)
self.icecube.setH(135)
self.icecube.setCollideMask(OFF)
self.iceWalkControl = self.icecube.getAnimControl("walk")
self.iceIsMoving = False
#set up icecube's collision geometry
raygeometry = CollisionRay(0, 0, 2, 0, 0, -1)
icecubeCollider = self.icecube.find("**/ice_box_collider")
icecubeCollider.node().setFromCollideMask(WALL|P2BODY)#!!!
icecubeCollider.node().setIntoCollideMask(P1BODY)
icecubeRay = self.icecube.attachNewNode(CollisionNode("icecubeRay"))
icecubeRay.node().addSolid(raygeometry)
icecubeRay.node().setFromCollideMask(FLOOR)
icecubeRay.node().setIntoCollideMask(OFF)
gives me an !is_empty() error at the line with the #!!!. Is it even possible to load collision geometry inside an actor, or does it have to be generated and attached in the code?
Thanks so much for your help! If I missed a relevant thread somewhere, please point me to it and keep the ribbing to a minimum