simulation.py
def _onKeyFireProjectile(self, keys=()): # {{{0
    "Callback: fire projectile(s) in the direction the camera is facing"
    ci = self.app.getCamera()
    cpos = self.app.getCameraPos()
    posStart = cpos + 8 * ci["camForward"]
    vz = ci["camUp"]
    vy = ci["camForward"]
    vx = np.cross(vy, vz)
    if p.B3G_SHIFT in keys:
      psize = self.app.getSlider("Projectile Size") * 0.5
      dxs = (
        V3(-1,  0, -1), V3( 0,  0, -1), V3( 1,  0, -1),
        V3(-1,  0,  0), V3( 0,  0,  0), V3( 1,  0,  0),
        V3(-1,  0,  1), V3( 0,  0,  1), V3( 1,  0,  1)
      )
      for dx in dxs:
        vec = 2 * psize * (vx * dx[0] + vy * dx[1] + vz * dx[2])
        self.app.setRealTime(False)
        self.app.fireProjectile(size=psize, pos=posStart + vec)
        self.app.setRealTime(True)
    else:
      self.app.fireProjectile(pos=posStart)
Callback: fire projectile(s) in the direction the camera is facing
fire projectile(s) in the direction the camera is facing
fire projectile ( s ) in the direction the camera is facing
def _onKeyFireProjectile(self, keys=()): 
    ci = self.app.getCamera()
    cpos = self.app.getCameraPos()
    posStart = cpos + 8 * ci["camForward"]
    vz = ci["camUp"]
    vy = ci["camForward"]
    vx = np.cross(vy, vz)
    if p.B3G_SHIFT in keys:
      psize = self.app.getSlider("Projectile Size") * 0.5
      dxs = (
        V3(-1,  0, -1), V3( 0,  0, -1), V3( 1,  0, -1),
        V3(-1,  0,  0), V3( 0,  0,  0), V3( 1,  0,  0),
        V3(-1,  0,  1), V3( 0,  0,  1), V3( 1,  0,  1)
      )
      for dx in dxs:
        vec = 2 * psize * (vx * dx[0] + vy * dx[1] + vz * dx[2])
        self.app.setRealTime(False)
        self.app.fireProjectile(size=psize, pos=posStart + vec)
        self.app.setRealTime(True)
    else:
      self.app.fireProjectile(pos=posStart)
def _onKeyFireProjectile ( self , keys = ( ) ) : ci = self . app . getCamera ( ) cpos = self . app . getCameraPos ( ) posStart = cpos + 8 * ci [ "camForward" ] vz = ci [ "camUp" ] vy = ci [ "camForward" ] vx = np . cross ( vy , vz ) if p . B3G_SHIFT in keys : psize = self . app . getSlider ( "Projectile Size" ) * 0.5 dxs = ( V3 ( - 1 , 0 , - 1 ) , V3 ( 0 , 0 , - 1 ) , V3 ( 1 , 0 , - 1 ) , V3 ( - 1 , 0 , 0 ) , V3 ( 0 , 0 , 0 ) , V3 ( 1 , 0 , 0 ) , V3 ( - 1 , 0 , 1 ) , V3 ( 0 , 0 , 1 ) , V3 ( 1 , 0 , 1 ) ) for dx in dxs : vec = 2 * psize * ( vx * dx [ 0 ] + vy * dx [ 1 ] + vz * dx [ 2 ] ) self . app . setRealTime ( False ) self . app . fireProjectile ( size = psize , pos = posStart + vec ) self . app . setRealTime ( True ) else : self . app . fireProjectile ( pos = posStart )
Callback: fire projectile(s) in the direction the camera is facing
Callback : fire projectile ( s ) in the direction the camera is facing
# {{{0 "Callback: fire projectile(s) in the direction the camera is facing"
self
keys