mouse wheel + turning to face

A quick question and a may-or-may not be quick question:

  1. Panda won’t recognise the mouse wheel. I try this, and nothing happens. Am I missing something dead obvious?
if base.mouseWatcherNode.isButtonDown(MouseButton.wheelUp()):
    print "Yes!"
elif base.mouseWatcherNode.isButtonDown(MouseButton.wheelDown()):
    print "No!"
  1. Is there a simple command to turn an object a set number of degrees towards another object, something like:
obj1.turnTo(obj2, 30)

…and if not, can anybody give a few pointers towards a simple and non-hackish way to code it? I’ve been banging my head on that one for a bit with no luck.

(1) A mouse wheel is never up or down. (Actually, I think the up-event is raised at the same moment as the down-event.) You need to catch the event if you want to know when the wheel is rolled.

And I have been trying so hard to avoid events… :frowning:

I don’t suppose there’s another way?

Why would you want to avoid events? Anyway, the rolling of the mouse wheel is an event, it’s not a state–it happens instantly, it’s not held down. So asking the question “is the mouse button rolling now” doesn’t make sense.

Unless you’re talking about clicking the mouse wheel like it’s a button. That’s just MouseButton.two().


Events seem a bit shit, is why. You write five times as much to code to do a simple thing to begin with, and then you have to worry about state changes and it’s just nightmare city.

…is what I was going to say, until I remembered from context that you’re one of the guys responsible for developing Panda(?). Panda’s great, really! Just a few quirks I’m getting my head around. :smiley:

Handling events properly can be complicated, it’s true. But sometimes it really is the only way. :slight_smile:


For the record i think panda3d event system is great. I was always a polling kind of guy but the panda3d event system is simple and without surprises i am sold.