orthographic camera

I’m trying to use a orthographic camera on my isometric game. I have tried to do this (don’t laugh):


		cam = Camera('custom')
		lens = OrthographicLens()		
		cam.setLens(lens)
		
		base.camera = cam

and of course it’s not how it’s done.

I’ve looked thru api reference and the manual and pdir(base) and pdir(base.camera)

I didn’t see an obvious way of doing this?
You guys must know an easy way to do this?

Thanks for any help?

Don’t try to replace the whole camera, just its lens:

lens = OrthographicLens()
base.camera.setLens(lens)

You will probably want to adjust the field of view, also. For an orthographic lens, this is done via the lens.setFilmSize() method, and the units are in physical units.

David

I had actually tried that and it didn’t work, which prompted me to try what I did.

This is what I get for doing that:


Traceback (most recent call last):
  File "game.py", line 79, in ?
    world = game()
  File "game.py", line 37, in __init__
    self.load_camera()
  File "game.py", line 71, in load_camera
    base.camera.setLens(lens)
AttributeError: NodePath instance has no attribute 'setLens'

this is what i write:


	def load_camera(self):
		'''this takes care of camera positioning'''
		lens = OrthographicLens()		
		base.camera.setLens(lens)

Any other idea?

Unfortunately, base.camera isn’t actually the camera node. Try this:


base.camNode.setLens( lens )

Cool! That worked out nicely.

Thanks.

John