I’d like to dig up this old thread to ask a related question:
How would I be able to move the camera in the direction of its orientation?, or for that matter to its right or to its left. I have been trying a million different ways and none seem to be valid. My latest attempt is parenting base.camera to a new ActorNode which I use to apply a velocity in the (hopeful) direction that the camera is facing. Here is my function that is called when a mouseWatcherRegion event is thrown:
def moveCam(self, foo, blah):
#this is what base.camera is parented to:
cam_PO = self.cameraActorNode.getPhysicsObject()
name = foo.getName()
heading = base.camera.getH()
pitch = base.camera.getP()
headingradians = heading * (math.pi / 180.0)
pitchradians = pitch * (math.pi / 180.0)
x = 18*math.sin(headingradians)
y = 18*math.cos(headingradians)
z = 18*math.sin(pitchradians)
print " "
if name == "topEdge":
elif name == "bottomEdge":
elif name == "leftEdge":
This unfortunately doesn’t work because it does not move the camera forward (It’s relative Y axis) when I want it to after I’ve rotated it!
Thank you so much in advance!