[solved] how do I start off with camera viewing a rectangle

from math import pi, sin, cos

from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import (GeomVertexFormat, GeomVertexArrayFormat, Geom, \
                          GeomVertexData, GeomVertexWriter, GeomTriangles, GeomNode)

class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        array = GeomVertexArrayFormat()
        array.addColumn("vertex", 3, Geom.NTFloat32, Geom.CPoint)
        array.addColumn("texcoord", 2, Geom.NTFloat32, Geom.CTexcoord)
        array.addColumn("normal", 3, Geom.NTFloat32, Geom.CNormal)
        array.addColumn("color", 4, Geom.NTFloat32, Geom.CColor)
        
        format = GeomVertexFormat()
        format.addArray(array)
        format = GeomVertexFormat.registerFormat(format)
        
        vdata = GeomVertexData("name", format, Geom.UHDynamic)
        vdata.setNumRows(4)
        
        vertex = GeomVertexWriter(vdata, 'vertex')
        
        color = GeomVertexWriter(vdata, 'color')
        texcoord = GeomVertexWriter(vdata, 'texcoord')
        normal = GeomVertexWriter(vdata, 'normal')
        
        vertex.addData3f(1, 0, 0)
        normal.addData3f(0, 0, 1)
        color.addData4f(0, 0, 1, 1)
        texcoord.addData2f(1, 0)
        
        vertex.addData3f(1, 0, 1)
        normal.addData3f(0, 0, 1)
        color.addData4f(0, 0, 1, 1)
        texcoord.addData2f(1, 1)
        
        vertex.addData3f(0, 0, 1)
        normal.addData3f(0, 0, 1)
        color.addData4f(0, 0, 1, 1)
        texcoord.addData2f(0, 1)
        
        vertex.addData3f(0, 0, 0)
        normal.addData3f(0, 0, 1)
        color.addData4f(0, 0, 1, 1)
        texcoord.addData2f(0, 0)
        
        prim = GeomTriangles(Geom.UHDynamic)
        
        prim.addVertices(0, 1, 2)
        prim.addVertices(0, 2, 3)
        
        geom = Geom(vdata)
        geom.addPrimitive(prim)
        
        node = GeomNode('my node')
        node.addGeom(geom)
        
        nodePath = self.render.attachNewNode(node)
        
        #self.camera.lookAt(0, 0, 0)
        #self.camera.lookAt(nodePath)
        self.camera.setPos(0, -30, 0)
        
        
        # Load the environment model.
        #self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render.
#self.scene.reparentTo(self.render)
        # Apply scale and position transforms on the model.
       # self.scene.setScale(0.25, 0.25, 0.25)
        #self.scene.setPos(-8, 42, 0)
        # Add the spinCameraTask procedure to the task manager.
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
 

    def spinCameraTask(self, task):
        print(self.camera.getPos())
        return Task.cont


app = MyApp()
app.run()

Here’s my code. As you can see I’ve even tried grabbing the camera position as I zoom out with the right mouse button (that works to bring it into view). However, setting the camera position to that value or even playing with the Hpr does nothing seemingly! I just want the camera to see my rectangle from the get go.

self.disableMouse() solved it.