def __init__(self,World, render,base,loader): BaseCharacter.__init__(self,World, render,base,loader) PandaCharacter.count += 1 self.id = PandaCharacter.count self.taskName = 'panda'+str(PandaCharacter.count) self.node = render.attachNewNode('panda'+str(PandaCharacter.count)) self.actor=Actor("models/panda-model", {"walk": "models/panda-walk4"}) self.actor.reparentTo(self.node) self.actor.setScale(0.002, 0.002, 0.002) self.actor.name = "Panda" self.cNode = CollisionNode('panda') self.cNode.addSolid(CollisionSphere(2, 0, 400, 500)) self.frowneyC = self.actor.attachNewNode(self.cNode) base.cTrav.addCollider(self.frowneyC, World.pusher) World.pusher.addCollider(self.frowneyC, self.actor, base.drive.node())
def __init__(self,World, render,base,loader): BaseCharacter.__init__(self,World, render,base,loader) RalphCharacter.count += 1 self.id = RalphCharacter.count self.taskName = 'ralph'+str(RalphCharacter.count) self.node = render.attachNewNode('ralph'+str(RalphCharacter.count)) self.actor = Actor("models/ralph/ralph", {"run":"models/ralph/ralph-run", "walk":"models/ralph/ralph-walk"}) self.actor.reparentTo(self.node) self.actor.setScale(.2) self.actor.name = "Ralph" # Create a collsion node for this object. self.cNode = CollisionNode('ralph') # Attach a collision sphere solid to the collision node. self.cNode.addSolid(CollisionSphere(0, 0, 3, 3)) # Attach the collision node to the object's model. self.smileyC = self.actor.attachNewNode(self.cNode) base.cTrav.addCollider(self.smileyC, World.pusher) World.pusher.addCollider(self.smileyC, self.actor, base.drive.node())
def __init__(self,World, render,base,loader): BaseCharacter.__init__(self,World, render,base,loader) VehicleCharacter.count += 1 self.node = render.attachNewNode('vehicle'+str(VehicleCharacter.count)) self.car = loader.loadModel("models/knucklehead") self.car_tex = loader.loadTexture("models/knucklehead.jpg") self.car.setTexture(self.car_tex, 1) self.car.setScale(.05) self.car.setP(-90) self.car.setH(180) self.car.setColor(0.6, 0.6, 1.0, 1.0) self.car.setColorScale(0.6, 0.6, 1.0, 1.0) self.actor = Actor(self.car) self.actor.reparentTo(self.node) self.actor.name = "vehicle" self.cNode = CollisionNode('car') self.cNode.addSolid(CollisionTube(0.0,0.5,1.0,0.0,-0.5,1.0,1.0)) self.carC = self.actor.attachNewNode(self.cNode) base.cTrav.addCollider(self.carC, World.pusher) World.pusher.addCollider(self.carC, self.actor, base.drive.node())