Controller Reactions

Do you want your code to react to a computer event?

There is a function called accept that is a method of a ShowBase class. You can use this function to attach an event (i.e, mouse press, key press, etc) to a function that you write.

self.accept("arrow_up-up", self.fn, ["forward", 0])

This line of code tells Panda that, when the up arrow is released, to run the function self.fn("forward", 0).

**Note- self.fn is any function that you write yourself as part of your animation. This is not a real function.

You can look up the various events on the Panda3D website.

results matching ""

    No results matching ""