World is not appearing

Hi,

Im just programming a little game. But I have got a little problem. I cant see the world, only my char.
Here are a few code sinps:

from pandac.PandaModules import * 
from direct.showbase.DirectObject import DirectObject
from direct.actor.Actor import Actor

import direct.directbase.DirectStart 

class World:
    def __init__(self, char):
        self.char = char
        
        base.disableMouse()
        base.camera.reparentTo(self.char)
        base.camera.setPosHpr(Vec3(0,50,10), self.char.getPos())
        base.camera.lookAt(self.char)
        
        self.environ = loader.loadModel("models/world")     #world
        self.environ.reparentTo(render)
        self.environ.setPos(0,0,0)

        taskMgr.add(self._main, '_main')

    def _main(self, task):
        self.char.walk()
        self.setHeight()
        self.cameraHandler()
        return task.cont


class Panda(Actor, ParentChar):
    def __init__(self, *args, **kwargs):
        ParentChar.__init__(self)
        Actor.__init__(self, *args, **kwargs)

        #...
        self.loop("run")
        self.stop()

panda = Panda('panda',{"run": "panda-walk",
                                "stand": "panda"})


w = PandaWorld(panda)
#taskMgr.add(w.main, 'main')
run()

That is not the full code. I can show more.

Do you have an Idea why this code doesnt show the world?

just a wild guess. but… did you reparent your char to render?? if not. try it :slight_smile:

Wow! Yes now it works. But what does that actually mean?

The camera is parented to the character. If the character is not parented into the scene, then the camera won’t be in the scene either. And if the camera is not in the scene, it can’t render anything from the scene. :slight_smile: