Advice and help thread...

If all you want is to make the walls visible, then just do this:

wall=enviro.find('**/coll')
wall.show()

Don’t mess with the bitmasks unless there is some specific reason to change the bitmasks.

David

base.cTrav.showCollisions(render)

This should show you the collision too.

There was a thread on how to use a group of animation in one file, but I can’t find it. Does anyone know how this would be done?

thanks,

KOZ

I would point you out this, hoping it helps.

sorry, not really. What I meant was if you have a group of animations in one file with the original model, how do you call them for use?

my stuff was for your main task (build a maze), I ain’t make clear that sorry. About your last question I aint what you ask but you may also load many single file animations to the same actor at once so I guess you’re wasting your time searching that…

First, make sure you’re loading your model as an Actor, not a generic Model. I’ve made that mistake multiple times. From there, if your animations aren’t neatly named/ID’d coming in from Blender (sorry, don’t know how to do that offhand, I’ve always been accepting premade models from artists), you may need to manually dig handles for them out of the Actor instance. See the API Reference and Manual for details on the Actor constructor and access methods.

Once you have handles to the animations, there should be fairly intuitive play()/start()-type methods associated with them, depending on which playback method you choose (direct play vs building into an interval vs manual posing). Again, see the Manual and Reference.

thanks. Another problem i have is that th Chicken exporter says it doesn’t export envelopes and when I expot the model with the animations, parts of the model don’t move with it. How do i fix?

just check if all the mesh vertexes gotta bone assigned to them

they do, but it still gives me that warning.

the warning is just a warning informing you that envelopes won’t be applied in your animations, but keyframes yes
if you mean that your model don’t move in Pview, so I guess could be for this reason (the bottom part) otherwise check the whole process steps in the provided link and your model will be ok

That is because chicken does not export the envelope method of deforming a mesh. It says right in the documentation that you have to use the armature modifier.

Thanks guys, i really apreciate the help. I have been working on this game for a competiton and your help has been so valuable. Another question though.

Ive set up the collision and everything for the from and into object but I cant seem to get the actor into the building because when i move it to the spot, The building’s collision mesh moves. Help?


wall=enviro.find('**/coll_1')
wall.show()


mc=Actor()
mc.loadModel('mc2.egg')
mc.setPos(7,8,15)
mc.setScale(0.15,0.15,0.15)
mc.reparentTo(render)
j=mc.play("run")
mc.loop("run")
#testing....

#base.disableMouse()

cam=base.camera
cam.setPos(0,30,19)
cam.reparentTo(mc)
cam.lookAt(mc)




render.setShaderAuto()

#######
c = mc.attachNewNode(CollisionNode('cnode'))
feet=CollisionSphere(0,0,-2,3)
cc=c.node().addSolid(feet)

c.show()
traverser = CollisionTraverser()
base.cTrav = traverser
pusher = CollisionHandlerPusher()
pusher.addCollider(c, wall)
traverser.addCollider(c,pusher)

No time to review your code in depth, but if you’re using a Pusher and the wrong geometry gets pushed, it probably means the wrong geometry is being passed to the pusher. Try switching where you plug your character and building colliders in.

That woked. but now Im havin issues with character movement. Roaming ralph Just managed to confuse the crap out of me and I have no Idea how to do it. my code isn’t in a class system and that doesn’t help much. Its nearing the end of the contest and this one vital piece is missing. Pleas help.


class World():
    def __init__(self):

       mc.isMoving = False

        self.keyMap = {"w":0, "a":0, "d":0}
        self.accept("escape", sys.exit,[0])

        self.accept("w", self.setKey, ["forward",1])
        self.accept("w-up", self.setKey, ["forward",0])
        self.accept("a", self.setKey, ["left",1])
        elf.accept("a-up", self.setKey, ["left",0])
        self.accept("d", self.setKey, ["right",1])
        self.accept("d-up", self.setKey, ["right",0])

        def taskMove(self, task):
      # move/rotate char
         if (self.keyMap["a"]!=0):
             mc.setH(mc.getH() + elapsed*300)
         if (self.keyMap["d"]!=0):
             mc.setH(mc.getH() - elapsed*300)
         if (self.keyMap["w"]!=0):
             mc.setY(mc, - (elapsed * speed))

      # handle anim
        if (self.keyMap["w"]!=0) or (self.keyMap["a"]!=0) or (self.keyMap["d"]!=0):
            if mc.isMoving == False:
                mc.loop("run")
                mc.isMoving = True
        else:
            if mc.isMoving:
                mc.stop()
                mc.isMoving = False
run()
# mc stands for the character

Thanks,

KOZ

Could someone please help me out here…

I’m assuming that your taskMove() is defined at the proper indent level, and that you’re adding it to taskMgr somewhere, and that ‘elapsed’ is being properly set as some function of time-since-last-call. Apart from that, the control logic looks sound enough. It would be useful to know what exactly is going wrong- the solution for a controls-not-registering type problem is going to be very different from a model-is-randomly-jittering type problem, for instance.

I adjusted the code:


def Controls():
    
    base.keyMap={"left":0, "right":0, "forward":0, "back":0}
    base.accept("escape",sys.exit)
    base.accept("w",self.setKey,["forward",1])
    base.accept("w-up",self.setKey,["forward",0])
    base.accept("a",self.setKey,["left",1])
    base.accept("a-up",self.setKey,["left",0])
    base.accept("d",self.setKey,["right",1])
    base.accept("d-up",self.setKey,["right",0])
    base.accept("s",self.setKey,["back",1])
    base.accept("s-up",self.setKey,["back",0])

    taskMgr.add(base.move,"moveTask")

    def setKey(base, key, value):
        base.keyMap[key] = value

    def move(self, task):
        elapsed = task.time - self.prevtime
        if (base.keyMap["left"]!=0):
            base.mc.setX(base.mc, - (elapsed*25))
        if (self.keyMap["right"]!=0):
            base.camera.setX(base.mc, + (elapsed*25))
        if (self.keyMap["forward"]!=0):
            base.camera.setY(base.mc, + (elapsed*25))
        if (self.keyMap["back"]!=0):
            base.mc.setY(base.mc, - (elapsed*25))

        base.prevtime = task.time
        return Task.cont

the problem is that it goes through, but doesn’t make the character move anywhere. Its wierd and there are no instructions in th manual as how to make movement. If there was that would be most helpfull.

Regards,

KOZ

Movement is not magic. It’s just a change in position. In your example,

base.mc.setX(base.mc, - (elapsed*25)) 

what is being set? Where is the value you’re setting it to coming from?
I know the answer you want to both of those, and I can vouch for the answer you’ve implemented to one of them, but for the other, you’re either using a syntax I’m unfamiliar with or you haven’t quite thought things through (and either way, until you get into heavy optimization, it’s usually better to use the more intuitive/readable syntax given the choice, both so others can read your code, and so you can sanity-check yourself).

Also, if you’re dumping your control code into a separate class, make sure you have an instance of that class in your world, and make sure any object the controls act upon is either passed into the control class or else scoped at a sufficiently global level to be accessible from 2 classes at once.

So how would I move it? would i use a “set Pos” or SetX" method?

Thanks,

KOZ