Panda3D + win7

How to configure Panda3D with PyCharm IDE and run a simple demo.

Install

  • Install Panda for windows
    • https://www.panda3d.org/download.php?platform=windows&version=1.8.1&sdk
  • Create a pyCharm project somewhere on disk
    • create one file named i.e. main.py
    • copy Demo code into it (viz next section)
  • File –> Settings –> Project –> Project Interpreter
    • click the gear button and navigate to:
      <Panda3D-install-folder>\python\python.exe
    • let the pyCharm index and sort things out
  • afterwards just run the main.py with the demo code copied
    • it should create a 3d scene which you can navigate with mouse

screen

This is how the scene looks like after a little going throuhg:

Demo code

from direct.actor.Actor import Actor
from pandac.PandaModules import *
from direct.task import Task
import math
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3
from pandac.PandaModules import *

import direct.directbase.DirectStart
from panda3d.core import CollisionTraverser,CollisionNode
from panda3d.core import CollisionHandlerQueue,CollisionRay
from panda3d.core import Filename,AmbientLight,DirectionalLight
from panda3d.core import PandaNode,NodePath,Camera,TextNode
from panda3d.core import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.showbase.DirectObject import DirectObject

# load terrain -if the model file is not there try to use another one
terrain = loader.loadModel('models/environment.egg.pz')
terrain.reparentTo(render)

base.oobe()
run()

References

 

Příspěvek byl publikován v rubrice Nezařazené a jeho autorem je admin. Můžete si jeho odkaz uložit mezi své oblíbené záložky nebo ho sdílet s přáteli.

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *