I was messing a round with a skySphere for my game
##############################################
# #IMPORT# #
##############################################
from pandac.PandaModules import *
##############################################
# #External Class IMPORT# #
##############################################
from shapes.shapeGenerator import Cube, Sphere
##############################################
# #NEW CLASS# #
##############################################
class SkyBox1():
def __init__(self, camera, boxOrSphere):
self.cameraNode1 = camera
if boxOrSphere == str("Box"):
self.loadSkyBox()
if boxOrSphere == str("Sphere"):
self.loadSkySphere()
def loadSkySphere(self):
self.Sphere = Sphere(10)
self.snp = render.attachNewNode("Sphere Node")
self.Sphere.reparentTo(self.snp)
self.snp.setTwoSided(True)
texture = loader.loadTexture("SpaceTexture.jpg")
self.Sphere.setTexture(texture)
#self.snp.reparentTo(self.cameraNode)
#self.snp.setBin("Background", 0)
#self.snp.setDepthWrite(False)
#self.snp.setCompass()
and when i import it
from SkyBox1 import *
it breaks my camera class
##############################################
# #IMPORT# #
##############################################
from direct.task.Task import Task
from direct.task.TaskManagerGlobal import taskMgr
##############################################
# #External Class IMPORT# #
##############################################
from panda3d.bullet import BulletSphereShape
from panda3d.bullet import BulletRigidBodyNode
##############################################
# #NEW CLASS# #
##############################################
class Camera():
def __init__(self, nodeToFollow, world):
self.np = nodeToFollow
self.world = world
self.attachCamera()
base.accept("wheel_up", self.cameraMove, extraArgs=[1])
base.accept("wheel_down", self.cameraMove, extraArgs=[-1])
#self.makeCameraCollision()
def attachCamera(self):
self.cn = render.attachNewNode('cameraNode')
self.cn.setPos(self.np.getPos())
base.camera.reparentTo(self.cn)
base.camera.setPos(0, -10, 10)
base.camera.lookAt(self.np)
def cameraMove(self, arg):
base.camera.setY(base.camera.getY() + arg)
base.camera.setZ(base.camera.getZ() - arg)
def makeCameraCollision(self):
#nodes
node = BulletRigidBodyNode('Box')
node.setMass(0)
self.ccnp = render.attachNewNode(node)
self.ccnp.reparentTo(self.cn)
#shapes
shape = BulletSphereShape(.5)
#nodes
node.addShape(shape)
#bullet world
self.world.attachRigidBody(node)
which is called here
def createCamera(self, nodePath):
self.camera = Camera(nodePath, self.world)
when skybox1 is imported i get this error with the camera class TypeError: Camera() argument 1 must be string or read-only buffer, not libpanda.NodePath and when its not imported it works fine 0.o i tried renaming SkyBox.py to SkyBox1.py thinking that the name was conflicting with a panda module but that did not work lol. Any ideas?