I’m trying to get back into Panda3D after rectifying my previous mistake of not knowing python very well. Anyway, I was taking some queues from some first person scripts people had built and I started taking a look at how this worked and I’m hoping there is a simple way to accomplish a “strafe.” I’m using a mouse look + WASD for movement.
direction = base.camera.getNetTransform().getMat().getRow3(1) direction.setZ(0) direction.normalize() if(self.keyMap["forward"] != 0): self.position += direction * .3
the value for position in the above snippit is just base.camera.getPos(). Going back and forward is easy enough, but I’m not sure how to add if statements for left/right. Any help would be much appreciated. Let me know if I need to add any additional code; but I figure most people have done some sort of FPS controller before.
edit to add:
Basically I can add any x,y values for the strafing left/right, but I’m not sure how to get a parallel vector to the direction the camera is facing and move along that.