Help! change to orthographic lens

Hi! I am working in a system for change: Orthographic --------> Perspective and Perspective --------> Orthographic

System Work with two buttons, Button1 with Function1 and Button2 with Function2.

def Function1():
           # Change to OrthographicLens
           lens = OrthographicLens()
           #lens.setFilmSize(20,15)  
           base.cam.node().setLens(lens)


def Function2():
     # Change to PerspectiveLens
     lens = PerspectiveLens()
     #lens.setFilmSize(20,15)  
     base.cam.node().setLens(lens)

Problem is that when back from OrthographicLens to PerspectiveLens, effectively change lenses to PerspectiveLens, but the appearance change objects are deformed are much wider than high. I tried to set different values lens.setFilmSize( , ) but the problem remains. ¿How do I return the camera to your state (lens) start?
Thanks :slight_smile:

You probably need to calculate the aspect ratio from the window dimensions.
As an easier alternative, you could just save the original lens in a variable and restore it later.

original_lens = base.cam.node().getLens()
ortho_lens = OrthographicLens()

def Function1():
           # Change to OrthographicLens
           base.cam.node().setLens(ortho_lens)


def Function2():
     # Change to PerspectiveLens
     base.cam.node().setLens(original_lens)

yeahhhh Thanks… solved :smiley: