Hi there!
In-between school and work I’ve been finding very little time to work on my P3D project. One thing that I haven’t been able to wrap my head around is the Panda Physics system. I was able to get my character to fall downwards initially, but I’ve somehow broken that along the way, and I can’t figure out what I’m doing wrong now.
I think I broke my physics when I decided to load my actorNode and Collison nodes from a BAM file instead of generating it at runtime, every single time. I modified my code to save a BAM file with all the relevant nodes as follows:
class pcColliders():
def __init__(self):
an = ActorNode("charaCenter")
centerNode = render.attachNewNode(an)
cn = CollisionNode("charaColHolder")
charaLine = CollisionSegment(0, 0, 0.25, 0, 0, -0.25)
charaBox = CollisionBox(Point3(0, 0, 0.01), 0.25, 0.25, 0.24)
cn.addSolid(charaLine)
cn.addSolid(charaBox)
charaColl = NodePath(cn)
charaColl.reparentTo(centerNode)
centerNode.writeBamFile("testboxes.bam")
I would then load testboxes.bam in with loader.loadModel(), but as ls() shows:
charaCenter is listed as a PandaNode. I also get errors when trying to treat it as an actorNode.
I do know I’m missing something from my physics code, namely
base.physicsMgr.attachPhysicalNode(an)
however, I understand neither what this does nor why charaCenter is now a PandaNode.
Is my only option to continue generating it at runtime?
I could understand if loading an actorNode from a BAM file would sidestep some necessary processes.