Beispiel #1
0
    def __init__( self, node, mouseWatcherNode ):

        self.node = node
        self.focusNode = render.attachNewNode("CameraFocusNode")
        self.attachmentNode = None
        self.attached = True

        self.focusPoint = LPoint3()

        self.mouseWatcherNode = mouseWatcherNode

        self.bForward = KeyboardButton.ascii_key('w')
        self.bBackward = KeyboardButton.ascii_key('s')
        self.bLeft = KeyboardButton.ascii_key('a')
        self.bRight = KeyboardButton.ascii_key('d')
        self.bSpeed = KeyboardButton.lshift()

        self.speed = 0.2

        self.zoom = 10

        self.ang = 0
        self.angY = math.pi*0.5

        self.lastMousePos = (0,0)
Beispiel #2
0
    def setup_bindings_for_sensors(self):
        modifiers = ModifierButtons()

        modifiers.addButton(KeyboardButton.lshift())
        modifiers.addButton(KeyboardButton.rshift())
        modifiers.addButton(KeyboardButton.lcontrol())
        modifiers.addButton(KeyboardButton.rcontrol())
        modifiers.addButton(KeyboardButton.lalt())
        modifiers.addButton(KeyboardButton.ralt())
        modifiers.addButton(KeyboardButton.meta())

        # For supporting "use_all_keys" and modifier keys
        button_node = base.buttonThrowers[0].node()
        button_node.setButtonDownEvent('buttonDown')
        button_node.setButtonUpEvent('buttonUp')
        button_node.setModifierButtons(modifiers)
Beispiel #3
0
    def __init__(self, node, mouseWatcherNode, speed=0.2):

        self.node = node

        self.headingNode = render.attachNewNode("CameraHeadingRotNode")
        self.pitchNode = self.headingNode.attachNewNode("CameraPitchRotNode")
        self.node.reparentTo(self.pitchNode)

        self.headingNode.setPos(0, 0, 0.5)

        #self.focusNode = render.attachNewNode("CameraFocusNode")
        self.attached = False

        self.headingNode.attachNewNode(createAxes(0.1))

        self.focusPoint = LPoint3()

        self.mouseWatcherNode = mouseWatcherNode

        self.bForward = KeyboardButton.ascii_key('w')
        self.bBackward = KeyboardButton.ascii_key('s')
        self.bLeft = KeyboardButton.ascii_key('a')
        self.bRight = KeyboardButton.ascii_key('d')
        self.bSpeed = KeyboardButton.lshift()

        self.speed = speed

        self.zoom = 10

        self.heading = 0
        self.pitch = -45

        self.node.setPos(0, -self.zoom, 0)
        self.pitchNode.setHpr(0, self.pitch, 0)
        self.headingNode.setHpr(self.heading, 0, 0)

        self.lastMousePos = (0, 0)