new to Panda. prob. with camera panning

Hi,
I am new to Panda.
I m right now able to achieve horizontal and vertical panning with middle button of mouse. but the environment also twists and turns. How to achieve an effect of a person looking up/down or left/right without the environment turning around. i.e. on moving the cursor up/down, the view should not tilt except 90degrees. up or down. Similarly for left and right.
The code as of now is as follows:

import direct.directbase.DirectStart
from pandac.PandaModules import CollisionTraverser,CollisionNode
from pandac.PandaModules import CollisionHandlerQueue,CollisionRay
from pandac.PandaModules import Filename
from pandac.PandaModules import PandaNode,NodePath,Camera,TextNode
from pandac.PandaModules import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
import random, sys, os, math

#Load the first environment model
environ = loader.loadModel(“models/environment”)
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)

def setMouseButton( self, button, value ):
self.mouse[ button ] = value

def _setupBase( self ):
props = base.win.getProperties( )
props.setCursorHidden( True )

    self.centerx = props.getXSize( )/2
    self.centery = props.getYSize( )/2

    base.disableMouse( )
    base.setBackgroundColor( 0, 0, 0 )
    base.win.requestProperties( props )
    base.win.movePointer( 0, self.centerx, self.centery )

def _setupInput( self ):
self.accept( ‘escape’, self.exit )

    #self.accept( 'mouse1', self.setMouseButton, [ 0, 1 ] )
    #self.accept( 'mouse1-up', self.setMouseButton, [ 0, 0 ] )
    self.accept( 'mouse2', self.setMouseButton, [ 1, 1 ] )
    self.accept( 'mouse2-up', self.setMouseButton, [ 1, 0 ] )
    #self.accept( 'mouse3', self.setMouseButton, [ 2, 1 ] )
    #self.accept( 'mouse3-up', self.setMouseButton, [ 2, 0 ] )

def updateCamera( self, task ):
md = base.win.getPointer( 0 )
x = md.getX( )
y = md.getY( )

    if base.win.movePointer( 0, self.centerx, self.centery ):
        self.heading += ( x - self.centerx ) * -0.2
        self.pitch += ( y - self.centery ) * -0.2
        self.pitch = clampScalar( self.pitch, -80.0, 80.0 )

    if self.mouse[ 0 ]:
        speed = 500 * ( task.time - self.last )
    elif self.mouse[ 1 ] or self.mouse[ 2 ]:
        speed =  -500 * ( task.time - self.last )
    else:
        speed = 0

    base.camera.setHpr( self.heading, self.pitch, 0 )
    base.camera.setPos( base.camera, Vec3( 0, 1, 0 ) * speed )

    self.last = task.time
    return Task.cont

run()

Excuse me, but I hate double-posts, and I really hate triple-posts.

You already posted this 2 times! What’s the use of that?

Someone who is genuinely trying to help me understand Panda3D concepts did not follow what I had written. so i was explaining in detail. I m here to learn and contribute not to see who likes and dislikes what. If u cannot help, i’ll appreciate if u do not express your personal opinions abt. anything.
I am a new learner. u may know much more than me but its never useful being arrogant.
Thank u very much.

Sorry I was a little upset. Though you can “explain in detail” in your own topic (in the showcase).

We can help you, but not 3 times with the same problem.

But anyway, we’re not going to discuss here whether this is a triple-post or not. :slight_smile:

It is alright. We are all here to learn and contribute. any and all help is always appreciated.