Why is this wrong??????????????????

from math import pi, sin, cos
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
class MyApp(ShowBase):
    def __init__(self):
		  self.keyMap = {"mouse1":0 , "mouse3":0 , "left":0 , "right":0 , "up":0 , "down":0}
		  self.accept("escape", sys.exit, [0])
    # Load the environment model.
        self.environ = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        # Apply scale and position transforms on the model.
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.setPos(-8, 42, 0)
        # Add the spinCameraTask procedure to the task manager.
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
        # Load and transform the panda actor.
        self.pandaActor = Actor("models/panda-model",
                                {"walk": "models/panda-walk4"})
        self.pandaActor.setScale(0.005, 0.005, 0.005)
        # Loop its animation.
    # Define a procedure to move the camera.
    def spinCameraTask(self, task):
        angleDegrees = task.time * 6.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -20.0 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont
app = MyApp()



self.keyMap = {“mouse1”:0 , “mouse3”:0 , “left”:0 , “right”:0 , “up”:0 , “down”:0}

indentation error.

i can’t put it.
it just gives me a wrong answer

this is so frustrating.
i forgot this language


I advise learning Python before you attempt to use Panda3D. We could explain to you what exactly is wrong, but if you don’t take the time to gain experience with Python, you will keep running into issues like these.


I agree, it’s much better to learn Python first.

Ensure that you never mix spaces(’ ‘) and tabs(’\t’) inside your program, also make sure the proper indention is used.

Hope this helps,


That’s the one thing that annoys me the most about Python. To avoid it I just always use the tab key when indenting lines of code. No need to count spaces with the space bar!


Most editors out there can automatically convert tabs to spaces, or insert the right amount of spaces automatically when you hit the tab key.