Objects rotates/moves to where camera looks

I have attached a camera to an object which can move around with the use of WASD. The camera can look freely from the object to all directions up to a certain angle. Now I was wondering on how to manage when the camera looks left and the user holds the “W” key. The object will curve in the direction of where the camera looks at and the end result will be that the object is positioned in front of the camera with the front of the object facing away from the camera (like an airplane of some sort).

from panda3d.core import loadPrcFileData
from panda3d.core import VBase4

import direct.directbase.DirectStart
from panda3d.core import WindowProperties
from panda3d.core import AmbientLight,PointLight,DirectionalLight
from panda3d.core import TextNode
from panda3d.core import Point3,Vec3,Vec4
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
import sys,os


class ThirdPersonCamera(DirectObject):

	def __init__(self):
		self.room = loader.loadModel("friendlyfruit/media/3dWarehouse_Reykjavik_Cathedral.egg")
		self.room.reparentTo(render)

		# Make the mouse invisible, turn off normal mouse controls
		base.disableMouse()
		props = WindowProperties()
		props.setCursorHidden(False)
		base.win.requestProperties(props)

		#Load player box
		self.player = loader.loadModel("friendlyfruit/media/ship.egg")
		self.player.reparentTo(render)
		self.player.setPos(0,10,0)
		
		#Attach camera to player box
		base.camera.reparentTo(self.player) 
		base.camera.setPos(0, 5, 1) 
		
		base.camera.lookAt(self.player)
		
		#base.camera.setZ(self.player.getZ() + 2.0)
		
		base.camera.setP(base.camera.getP())
			
		# Set the current viewing target
		self.focus = Vec3(0,0,0)
		self.heading = 0
		self.pitch = 0
		self.mousex = 0
		self.mousey = 0
		self.last = 0
		self.keys = [0,0,0,0,0]

        # Start the camera control task:
		taskMgr.add(self.controlPlayer, "player-task")
		self.accept("escape", sys.exit, [0])
		self.accept("w", self.setKeys, [0, 1])#forward
		self.accept("w-up", self.setKeys, [0, 0])
		self.accept("s", self.setKeys, [1, 1])#back
		self.accept("s-up", self.setKeys, [1, 0])
		self.accept("a", self.setKeys, [2, 1])#strafe left
		self.accept("a-up", self.setKeys, [2, 0])
		self.accept("d", self.setKeys, [3, 1])#strafe right
		self.accept("d-up", self.setKeys, [3, 0])
		self.accept("space", self.setKeys, [4, 1])
		self.accept("space-up", self.setKeys, [4, 0])
       
		# Add an ambient light
		plight = PointLight('plight')
		plight.setColor(VBase4(0.5, 0.5, 0.5, 1))
		plnp = render.attachNewNode(plight)
		plnp.setPos(10, 20, 0)
		render.setLight(plnp)
		
		dlight = DirectionalLight('dlight')
		dlight.setColor(VBase4(0.8, 0.8, 0.5, 1))
		dlnp = render.attachNewNode(dlight)
		dlnp.setHpr(0, -60, 0)
		render.setLight(dlnp)
		
		alight = AmbientLight('alight')
		alight.setColor(Vec4(0.4, 0.4, 0.4, 1))
		alnp = render.attachNewNode(alight)
		self.room.setLight(alnp)
		self.player.setLight(alnp)

 
	#switch upon which buttons are pressed with if statements
	def setKeys(self, btn, value):
		self.keys[btn] = value

    #main
	def controlPlayer(self, task):
		
		#Camera Information
		md = base.win.getPointer(0)
		x = md.getX()
		y = md.getY()
		
		#Player movement
		if (self.keys[0]):
			self.player.setPos(self.player, 0, -1, 0)
		if (self.keys[1]):
			self.player.setPos(self.player, 0, 1, 0)
		if (self.keys[2]):
			self.player.setPos(self.player, 1, 0, 0)
		if (self.keys[3]):
			self.player.setPos(self.player, -1, 0, 0)



		#Mouse looking
		if base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2):
			#Horizontal looking
			base.camera.setH(base.camera.getH() -  (x - base.win.getXSize()/2)*0.1)
			#Vertical looking
			base.camera.setP(base.camera.getP() - (y - base.win.getYSize()/2)*0.1)
		
		#Bottom boundary
		if base.camera.getP() < -15:
			base.camera.setP(-15)
		#Top boundary
		if base.camera.getP() > 12:
			base.camera.setP(12)
		#Right boundary	
		if base.camera.getH() < 165:
			base.camera.setH(165)
		#Left boundary
		if base.camera.getH() > 200:
			base.camera.setH(200)
		
		
		print base.camera.getH(), base.camera.getP()

		return Task.cont
		
		


play = ThirdPersonCamera()

run()