Hi all!

Howdy folks! I am new to the forums here, trying to learn a bit about Panda3d. This is my first major foray into coding anything within an engine; I am starting my last year at university studying CS, and my programming experience up til now has been fairly limited. I know a fair bit of python, but most of my training was in Java so I haven’t been struggling with the language much.

I have followed a couple tutorials, there was one pretty informative one at mygamefast.com that was kinda quick and dirty but got me involved with a lot of concepts. Right now I am working on manipulating the various sample programs that are on the Panda website, hoping to learn all kinds of things. My goal for this weekend is to turn the ‘solar system’ sample into a bit better representation of the solar system (changing the angle of orbits and textures and things, maybe adding moons to mars, etc. (ignoring, of course, the actual spatial issues,) as well as create a user-controlled spaceship that can fly around in the large sphere.

So, I’ll keep yall posted on progress, but right now I am asking for any tips anyone has for someone learning panda for the first time.

So, I am running into a simple issue; I am using the tea kettle as my space ship in my solar system for now, and I am trying to retexture it but all I can manage to do is change the color of it; Here is my code:

        self.ship = loader.loadModel("models/teapot")
        self.ship.reparentTo(render)
        self.ship.setPos(0,0,10)
        self.ship_tex = loader.loadTexture("models/maps/noise.rgb")
        self.ship.setTexture(self.ship_tex, 1)

Rather than giving a texture at all, this shifts it from a boring white to a boring olive green. I’ve looked through the manual and some other tutorials; anyone have any ideas?

Also, for future reference, does anyone know a place I can upload screenshots and etc. for quick and safe reference?

i dont know by head but i would guess the teapot does not have uv-coordinates. either use a model with uv-coords or use panda’s texture mapping mechanism to create those on the fly

Thanks for the help! You were right, and I was able to assign some variables in panda and get the texture to map. I am now running into a new problem. I got a neat control system for flying my teapot around space, and I waned to add some background sound to make it a better experience. Here is a (mostly) working code bit:

        self.bgsound =  loader.loadSfx("models/bgsound.mp3")
        self.bgsound.setLoop(True)
        self.bgsound.setVolume(0.2)
        self.bgsound.play()

A couple of questions/issues. The manual says that panda treats sound and music differently, but only explains one method of using sounds which I have implemented here; since I want this to be background music is there another (better) way to do it?

Additionally, this Mp3 is about a minute long and when I close the panda window it continues to play through in it’s entirety. Is there a way I can make it stop on exit?

There’s both

base.loadSfx()

and

base.loadMusic()

You can also use loader.loadSfx() or loader.loadMusic(), by the way. The functions at base are mainly for backwards compatibility, but do exactly the same.

A short explanation of both managers can be found here: panda3d.org/manual/index.php/Audio_Managers

The main reason why music and sfx are handled separately by ShowBase is because of two reasons, i believe:

  1. You can manually set the volume for (or mute) both music and SFX individually.
  2. Sounds can be localized and played in 3D. Means if you place a sound source to the right to the camera, the sound will come from the right speaker and vice versa.