How to use the panda3d.core.Point3 function in Panda3D

To help you get started, we’ve selected a few Panda3D examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Toontown-School-House / Toontown-School-House / toontown / suit / DistributedBossbotBoss.py View on Github external
def makeIntroductionMovie(self, delayDeletes):
        rToon = self.resistanceToon
        rToonStartPos = Point3(ToontownGlobals.BossbotRTIntroStartPosHpr[0], ToontownGlobals.BossbotRTIntroStartPosHpr[1], ToontownGlobals.BossbotRTIntroStartPosHpr[2])
        rToonEndPos = rToonStartPos + Point3(40, 0, 0)
        elevCamPosHpr = ToontownGlobals.BossbotElevCamPosHpr
        closeUpRTCamPos = Point3(elevCamPosHpr[0], elevCamPosHpr[1], elevCamPosHpr[2])
        closeUpRTCamHpr = Point3(elevCamPosHpr[3], elevCamPosHpr[4], elevCamPosHpr[5])
        closeUpRTCamPos.setY(closeUpRTCamPos.getY() + 20)
        closeUpRTCamPos.setZ(closeUpRTCamPos.getZ() + -2)
        closeUpRTCamHpr = Point3(0, 5, 0)
        loseSuitCamPos = Point3(rToonStartPos)
        loseSuitCamPos += Point3(0, -5, 4)
        loseSuitCamHpr = Point3(180, 0, 0)
        waiterCamPos = Point3(rToonStartPos)
        waiterCamPos += Point3(-5, -10, 5)
        waiterCamHpr = Point3(-30, 0, 0)
        track = Sequence(Func(camera.reparentTo, render), Func(camera.setPosHpr, *elevCamPosHpr), Func(rToon.setChatAbsolute, TTL.BossbotRTWelcome, CFSpeech), LerpPosHprInterval(camera, 3, closeUpRTCamPos, closeUpRTCamHpr), Func(rToon.setChatAbsolute, TTL.BossbotRTRemoveSuit, CFSpeech), Wait(3), Func(self.clearChat), self.loseCogSuits(self.toonsA + self.toonsB, render, (loseSuitCamPos[0],
         loseSuitCamPos[1],
         loseSuitCamPos[2],
         loseSuitCamHpr[0],
         loseSuitCamHpr[1],
         loseSuitCamHpr[2])), self.toonNormalEyes(self.involvedToons), Wait(2), Func(camera.setPosHpr, closeUpRTCamPos, closeUpRTCamHpr), Func(rToon.setChatAbsolute, TTL.BossbotRTFightWaiter, CFSpeech), Wait(1), LerpHprInterval(camera, 2, Point3(-15, 5, 0)), Sequence(Func(rToon.suit.loop, 'walk'), rToon.hprInterval(1, VBase3(270, 0, 0)), rToon.posInterval(2.5, rToonEndPos), Func(rToon.suit.loop, 'neutral')), Wait(3), Func(rToon.clearChat), Func(self.__hideResistanceToon))
        return track
github panda3d / panda3d / direct / src / wxwidgets / ViewPort.py View on Github external
  @staticmethod
  def makePerspective(parent):
    v = Viewport('persp', parent)
    v.camPos = Point3(-19, -19, 19)
    v.camLookAt = Point3(0, 0, 0)

    v.grid = DirectGrid(parent=render)
    collPlane = CollisionNode('PerspGridCol')
    collPlane.addSolid(CollisionPlane(Plane(0, 0, 1, 0)))
    #oldBitmask = collPlane.getIntoCollideMask()
    #collPlane.setIntoCollideMask(BitMask32.bit(21)|oldBitmask)
    collPlane.setIntoCollideMask(BitMask32.bit(21))
    v.collPlane = NodePath(collPlane)
    v.collPlane.reparentTo(v.grid)

    collPlane2 = CollisionNode('PerspGridCol2')
    collPlane2.addSolid(CollisionPlane(Plane(0, 0, -1, 0)))
    #oldBitmask = collPlane2.getIntoCollideMask()
    #collPlane2.setIntoCollideMask(BitMask32.bit(21)|oldBitmask)
    collPlane2.setIntoCollideMask(BitMask32.bit(21))
    v.collPlane2 = NodePath(collPlane2)
github Toontown-School-House / Toontown-School-House / toontown / coghq / DistributedBanquetTable.py View on Github external
return targetScale

        track.append(LerpScaleInterval(sprayScale, dScaleUp, calcTargetScale, startScale=Point3(0.01, 0.01, 0.01)))
        track.append(Func(self.checkHitObject))
        track.append(Wait(dHold))

        def prepareToShrinkSpray(spray, sprayProp, origin, target):
            if callable(target):
                target = target()
            if callable(origin):
                origin = origin()
            sprayProp.setPos(Point3(0.0, -SPRAY_LEN, 0.0))
            spray.setPos(target)

        track.append(Func(prepareToShrinkSpray, spray, sprayProp, origin, target))
        track.append(LerpScaleInterval(sprayScale, dScaleDown, Point3(0.01, 0.01, 0.01)))

        def hideSpray(spray, sprayScale, sprayRot, sprayProp, propPool):
            sprayProp.detachNode()
            MovieUtil.removeProp(sprayProp)
            sprayRot.removeNode()
            sprayScale.removeNode()

        track.append(Func(hideSpray, spray, sprayScale, sprayRot, sprayProp, MovieUtil.globalPropPool))
        return track
github gamingrobot / second-sunrise / game / plugins / core / planets / planets.py View on Github external
def generatePlusChunks(self, point, name):
        #main chunk first but for speed its in the middle
        #self.chunks.makeChunk(point + Point3(0, 0, 0), self.planets[name].getNode(), name)
        #rest of plus sign
        self.chunks.makeChunk(point + Point3(1, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 1, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, 1), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(-1, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, -1, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, -1), self.planets[name].getNode(), name)
github gamingrobot / second-sunrise / game / plugins / core / planets / planets.py View on Github external
def generatePlusChunks(self, point, name):
        #main chunk first but for speed its in the middle
        #self.chunks.makeChunk(point + Point3(0, 0, 0), self.planets[name].getNode(), name)
        #rest of plus sign
        self.chunks.makeChunk(point + Point3(1, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 1, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, 1), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(-1, 0, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, -1, 0), self.planets[name].getNode(), name)
        self.chunks.makeChunk(point + Point3(0, 0, -1), self.planets[name].getNode(), name)
github Toontown-School-House / Toontown-School-House / toontown / minigame / DistributedCogThiefGame.py View on Github external
return
        rng = self.toonRNGs[self.avIdList.index(avId)]
        curPos = toon.getPos(render)
        oldTrack = self.toonHitTracks[avId]
        if oldTrack.isPlaying():
            oldTrack.finish()
        toon.setPos(curPos)
        toon.setZ(self.TOON_Z)
        parentNode = render.attachNewNode('mazeFlyToonParent-' + `avId`)
        parentNode.setPos(toon.getPos())
        toon.reparentTo(parentNode)
        toon.setPos(0, 0, 0)
        startPos = parentNode.getPos()
        dropShadow = toon.dropShadow.copyTo(parentNode)
        dropShadow.setScale(toon.dropShadow.getScale(render))
        trajectory = Trajectory.Trajectory(0, Point3(0, 0, 0), Point3(0, 0, 50), gravMult=1.0)
        oldFlyDur = trajectory.calcTimeOfImpactOnPlane(0.0)
        trajectory = Trajectory.Trajectory(0, Point3(0, 0, 0), Point3(0, 0, 50), gravMult=0.55)
        flyDur = trajectory.calcTimeOfImpactOnPlane(0.0)
        avIndex = self.avIdList.index(avId)
        endPos = CTGG.ToonStartingPositions[avIndex]

        def flyFunc(t, trajectory, startPos = startPos, endPos = endPos, dur = flyDur, moveNode = parentNode, flyNode = toon):
            u = t / dur
            moveNode.setX(startPos[0] + u * (endPos[0] - startPos[0]))
            moveNode.setY(startPos[1] + u * (endPos[1] - startPos[1]))
            flyNode.setPos(trajectory.getPos(t))

        flyTrack = Sequence(LerpFunctionInterval(flyFunc, fromData=0.0, toData=flyDur, duration=flyDur, extraArgs=[trajectory]), name=toon.uniqueName('hitBySuit-fly'))
        geomNode = toon.getGeomNode()
        startHpr = geomNode.getHpr()
        destHpr = Point3(startHpr)
github pbattaglia / scenesim / scenesim / display / viewer.py View on Github external
top = self.cameras.getTop()
        p0 = Point3()
        p1 = Point3()
        self.sso.calcTightBounds(p0, p1)
        shape = p1 - p0
        extent = (shape[0], shape[2])
        extent = [max(extent)] * 2
        center = shape / 2. + p0
        # Adjust camera's x-position.
        self.cameras.setX(top, center[0])
        self.cameras.setZ(top, p1[2])
        # Compute where camera will point.
        # look_at = Point3(center[0], self.look_at.getY(), self.look_at.getZ())
        # look_at = (center[0], center[1], self.look_at.getZ())
        look_at = center
        origin = Point3(center[0], center[1], p1[2])
        displacement = self.cameras.getPos(top) - origin
        distance = displacement.length()
        fov = self.cam.node().getLens().getFov()
        target_ratio = 0.65
        dx = extent[0] / 2. / target_ratio / tan(radians(fov[0]) / 2.)
        dz = extent[1] / 2. / target_ratio / tan(radians(fov[1]) / 2.)
        dr = max(dx, dz) / distance
        pos = origin + displacement * dr
        self.cameras.setPos(top, pos)
        #BP()
        # Point camera toward stim.
        self.look_at.setPos(top, look_at)
        self.cameras.lookAt(self.look_at)
github cosmonium / cosmonium / third-party / pandamenu / menu.py View on Github external
minZ=self.minZ, useMouseZ=False
      )
      self.submenuIdx=idx
      self.submenu.parentMenu=self
      if self.menu.getBinName():
         self.submenu.menu.setBin(self.menu.getBinName(),self.menu.getBinDrawOrder()+1)
      sb3=self.submenu.menu.getTightBounds()
      sb=sb3[1]-sb3[0]
      b3=self.menu.getTightBounds()
      x=b3[1][0]
      if render2d.getRelativePoint(self.parent,Point3(x+sb[0],0,0))[0]>.98:
         x=b3[0][0]-sb[0]
      if render2d.getRelativePoint(self.parent,Point3(x,0,0))[0]<-.98:
         x=self.parent.getRelativePoint(render2d,Point3(-.98,0,0))[0]
      item=self.menu.find('**/*-pg%s'%(self.firstButtonIdx+idx))
      z=self.parent.getRelativePoint(item,Point3(0,0,item.node().getFrame()[3]))[2]+self.bgPad
      self.submenu.menu.setPos(x,0,max(z,self.submenu.menu.getZ()))
#       self.submenu.menu.setPos(x,0,z)
github gamingrobot / second-sunrise / game / plugins / Core / chunks / chunks.py View on Github external
point = Point3(x + 1, y + 1, z + 1)
        if point in chunks:
            terrain[1] = chunks[point].getTerrain()
        point = Point3(x + 1, y + 1, z)
        if point in chunks:
            terrain[2] = chunks[point].getTerrain()
        point = Point3(x + 1, y, z + 1)
        if point in chunks:
            terrain[3] = chunks[point].getTerrain()
        point = Point3(x, y + 1, z + 1)
        if point in chunks:
            terrain[4] = chunks[point].getTerrain()
        point = Point3(x + 1, y, z)
        if point in chunks:
            terrain[5] = chunks[point].getTerrain()
        point = Point3(x, y + 1, z)
        if point in chunks:
            terrain[6] = chunks[point].getTerrain()
        point = Point3(x, y, z + 1)
        if point in chunks:
            terrain[7] = chunks[point].getTerrain()
        return terrain
github gamingrobot / second-sunrise / game / plugins / core / chunks / chunks.py View on Github external
def getNeighbors(self, cords, chunks):
        terrain = [None for i in range(8)]
        x, y, z = cords[0], cords[1], cords[2]
        terrain[0] = chunks[Point3(x, y, z)].getTerrain()
        point = Point3(x + 1, y + 1, z + 1)
        if point in chunks:
            terrain[1] = chunks[point].getTerrain()
        point = Point3(x + 1, y + 1, z)
        if point in chunks:
            terrain[2] = chunks[point].getTerrain()
        point = Point3(x + 1, y, z + 1)
        if point in chunks:
            terrain[3] = chunks[point].getTerrain()
        point = Point3(x, y + 1, z + 1)
        if point in chunks:
            terrain[4] = chunks[point].getTerrain()
        point = Point3(x + 1, y, z)
        if point in chunks:
            terrain[5] = chunks[point].getTerrain()
        point = Point3(x, y + 1, z)
        if point in chunks:
            terrain[6] = chunks[point].getTerrain()
        point = Point3(x, y, z + 1)
        if point in chunks:
            terrain[7] = chunks[point].getTerrain()
        return terrain