ralph moving help

well, i just copied this code from the roaming ralph tut.

        backward = smi.getNetTransform().getMat().getRow3(1)
        backward.setZ(0)
        backward.normalize()
        smi.setPos(smi.getPos() - (backward/3))

but i’d like to know how it works.
can anyone explain how it works or direct me to a page in the manual where it is explained?

thanks in advance,

assainator

That code is weird. The Roaming Ralph sample will be updated to contain better code in the upcoming 1.6.0 release of Panda.
This is more or less the better equivalent:

        smi.setY(smi, globalClock.getDt() * speed)

Where speed is how much units smi should move relative to it’s own coordinate system.

that’s right, the code out of the example is:

        if (self.keyMap["left"]!=0):
            self.ralph.setH(self.ralph.getH() + elapsed*300)
        if (self.keyMap["right"]!=0):
            self.ralph.setH(self.ralph.getH() - elapsed*300)
        if (self.keyMap["forward"]!=0):
            backward = self.ralph.getNetTransform().getMat().getRow3(1)
            backward.setZ(0)
            backward.normalize()
            self.ralph.setPos(self.ralph.getPos() - backward*(elapsed*5))

but i addapted it to my needs (wich are less)

assainator