O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - setting up mouse aim

Mouse picking requires the collision system, so we'll be using collision solids and all that again. Take a look back to Chapter 6, The World in Action: Handling Collisions as we go, if it's needed.

  1. Have a look in the Chapter10 folder and open up the InputMangaer_00.py file there.
  2. A new import comes first. Add this line to our imports section:
    from pandac.PandaModules import *
    
  3. Next, we'll add a call to a new method to the bottom of __init__ method:
    self.setupMouseAim()
    
  4. Now, let's go ahead and add that new method to the bottom of the class:
    def setupMouseAim(self): self.CN = CollisionNode("RayCN") self.cRay = CollisionRay() self.CN.addSolid(self.cRay) self.CN.setFromCollideMask(BitMask32.bit(8)) self.CN.setIntoCollideMask(BitMask32.allOff()) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required