1st person camera, "free view" style

it did end up rude :confused: I learn from critisism and will try to give my objective opinion anyway:
The point of this snippet is to show people how to implement 1st person camera with rotation, movement and panning without any real math, by using the parent/child relations in Panda. That’s it.

From what I’ve learned any “global” declaration in a function is pretty much “abuse” of Python’s global scope, the most common “workarounds” are to use dictionary or class as container for your shared variables or just have your whole code in a class.

class Globals:
    pass

Globals.a = 1

def myFunction():
    Globals.a = 2

myFunction()
print Globals.a

or only declare dictionary global

globals = {}

globals['a'] = 1

def myFunction():
    global globals
    globals['a'] = 2

myFunction()
print globals['a'] 

Others suggest to wrap everything you have in a class and create a single instance just to add an extra scope.
It’s my opinion that for a small snippet like this which is not intended to be used out-of-the-box, it’s not worth it. Every time this kind of “accessing local variables from elsewhere” discussion pops-up, it turns into some kind of religious war where people argue which one of the above methods is better without any good points.

From the other similar camera snippets Ive seen here I dont see how mine provides less info (‘anything valuable’) and seeing how short snippets like Blender scripts make use of “global”, I dont see how it’s a big deal for such a small snippet. I personally haven’t used any snippets from here out-of-the-box and end up just learning from them and adding to my own code.

Ive found the Panda3d forums to be one of the nicest programming forums and although I’m not offended, I’d still suggest you to be a bit more nice and not jump straight to the “criticism”, if it were someone else, he could have just read these posts as complaints on how bad his work is and you could lose another member. I am trying to be helpful when posting my own code to public, I dont get anything from it, so a “thanks” or “nice try” wouldn’t hurt.