How to export Blender object into Panda3D 1.9.2 game engine

Panda3D 1.9.2 is a nice game engine which we can use it to create commercial game or free game and then either sell or distribute our game on the gaming market place. One cool thing about Panda3D is that it actually allows us to import object creates in Blender to our game which we can then use it as a gaming character. Today I am going to show you how to export Blender object into Panda3D 1.9.2 gaming engine with ease.

First of all if you are using Blender 2.77 and above then you will need to import YABEE addon into Blender before you can export your model in the EGG format to the Panda3D game engine. Chicken addon does not work on Blender 2.77. Therefore go ahead and download the YABEE addon first from the above mentioned link and then go to File->User Preferences and click on the Add-ons tab then click on the Install from File button at the bottom of the Add-ons panel and import the YABEE addon into blender.

Next create what ever object you wish to in Blender and then select that entire object which you want to export and go into the Edit mode, under the Edit mode press the u key then select Unwrep. Next go back to Object mode and go to File->Export->Panda3D(.egg). As for now follow below screen shot to do the export setting on the sidebar of the addon panel. You can adjust the setting later on.

YABEE EGG
YABEE EGG

After you have selected the folder to export the EGG file and provided the file with a name, for example boy.egg, click on the Export to Panda3D EGG button to export the file. You will find out that there are one egg file and one tex folder in that folder, the tex folder is where YABEE exports and keeps all the textures for the Blender’s model you have created.

Now lets put the object into the game. Create a python file and name it boy.py as follow in the same folder you have exported the egg file.

import direct.directbase.DirectStart

class Boy:

	def __init__(self):
		base.setBackgroundColor(0,0,0)
		self.track = loader.loadModel("./boy.egg")
		self.track.reparentTo(render)

b = Boy()

base.run()

Notice that the ./boy.egg is the relative path to the egg file. Next under your windows command prompt type in ppython boy.py to run the program. You must use ppython instead of python or else you will see an error because Panda3D uses it’s own set of python tool to run the program. You should see below object after you have started the program,

Panda3D
Panda3D

if not then press on the left mouse button and drag the mouse within the Panda panel screen above to reveal the object. If you are interested in learning Panda3D programming then you can find it all in https://www.panda3d.org.

That is all, I wish you good luck in your next Python game project!