#Camera settings
base.camera.setPos(100,100,100)
If I am not mistaken, the above should move the camera to XYZ coordinates of 100 each. The camera simply won’t move anywhere regardless of where I tell it to be.
I checked it’s location using the getX(), getY() and getZ() functions and the functions each return 100.
I’m so confused. Also, when I move the camera using the mouse, should not the locations also update according to where it is? Because that doesn’t happen either. =/
Here’s the entire code I am working off of right now if it helps:
#Imports
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import Point3
#from pandac.PandaModules import *
#
#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.showbase.DirectObject import DirectObject
import random, sys, os, math
#Main Loop
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# Function to put messages on the screen.
def addMessages(pos, msg):
return OnscreenText(text=msg, style=1, fg=(1,1,1,1),
pos=(-1.3, pos), align=TextNode.ALeft, scale = .05)
#Load environment model
self.environ = self.loader.loadModel("world.egg.pz")
#Reparent the model to render
self.environ.reparentTo(self.render)
#Apply scale and position
self.environ.setScale(25, 25, 25)
self.environ.setPos(-8, 42, 0)
#Load all actors
self.g1_1 = Actor("tron.egg.pz", {"run": "tron_anim.egg.pz"})
self.g1_2 = Actor("tron.egg.pz")
#Set actor scale and position
self.g1_1.setScale(1,1,1)
self.g1_1.setPos(0,80,80)
self.g1_2.setScale(1,1,1)
self.g1_2.setPos(6,80,80)
#Parent actors to render tree
self.g1_1.reparentTo(self.render)
self.g1_2.reparentTo(self.render)
#Camera settings
base.camera.setPos(100,100,100)
#Loop anims
self.g1_1.setPlayRate(1, "run")
self.g1_1.loop("run", fromFrame = 1, toFrame = 30)
#Add display info
disp1_content = "Camera XYZ: " + str(self.camera.getX()) + ", " + str(self.camera.getY()) + ", " + str(self.camera.getZ())
self.disp1 = addMessages(0.95, disp1_content)
#Run game
game = Game ()
game.run ()