当前位置: 首页>>代码示例>>Python>>正文


Python CollisionHandlerEvent.set_out_pattern方法代码示例

本文整理汇总了Python中panda3d.core.CollisionHandlerEvent.set_out_pattern方法的典型用法代码示例。如果您正苦于以下问题:Python CollisionHandlerEvent.set_out_pattern方法的具体用法?Python CollisionHandlerEvent.set_out_pattern怎么用?Python CollisionHandlerEvent.set_out_pattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.CollisionHandlerEvent的用法示例。


在下文中一共展示了CollisionHandlerEvent.set_out_pattern方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getSprayTrack

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
    def getSprayTrack(self, origin, target, scaleUp, hold, scaleDown, horizScale = 1.0, vertScale = 1.0):
        base.localAvatar.stop(self.toonAnim)
        self.lastFrame = self.avatar.getCurrentFrame(self.toonAnim)
        track = Sequence()
        sprayProp = loader.loadModel(GagGlobals.SPRAY_MDL)
        sprayProp.setTwoSided(1)
        sprayScale = hidden.attachNewNode('spray-parent')
        sprayRot = hidden.attachNewNode('spray-rotate')
        sprayRot.setColor(GagGlobals.WATER_SPRAY_COLOR)
        sprayRot.setTransparency(1)
        collNode = CollisionNode('Collision')
        spraySphere = CollisionSphere(0, 0, 0, 1)
        spraySphere.setTangible(0)
        collNode.addSolid(spraySphere)
        collNode.setCollideMask(CIGlobals.WallBitmask)
        sprayNP = sprayRot.attachNewNode(collNode)
        sprayNP.setY(1)
        self.sprayNP = sprayNP
        event = CollisionHandlerEvent()
        event.set_in_pattern('%fn-into')
        event.set_out_pattern('%fn-out')
        base.cTrav.add_collider(sprayNP, event)
        self.avatar.acceptOnce(sprayNP.node().getName() + '-into', self.onCollision)

        def showSpray(sprayScale, sprayProp, origin, target):
            objects = [sprayRot, sprayScale, sprayProp]
            for item in objects:
                index = objects.index(item)
                if index == 0:
                    item.reparentTo(self.sprayJoint)
                    item.setPos(self.sprayJoint.getPos(render))
                    item.setHpr(self.sprayJoint.getHpr(render))
                    item.setP(0)
                else:
                    item.reparentTo(objects[index - 1])
                item.clearMat()

        track.append(Func(showSpray, sprayScale, sprayProp, origin, target))
        self.spray = sprayRot

        def calcTargetScale():
            distance = Vec3(target - origin).length()
            yScale = distance / GagGlobals.SPRAY_LEN
            targetScale = Point3(yScale * horizScale, yScale, yScale * vertScale)
            return targetScale

        track.append(Parallel(LerpScaleInterval(sprayScale, scaleUp, calcTargetScale, startScale=GagGlobals.PNT3NEAR0), sprayNP.posInterval(0.25, self.spray.getPos(render) + Point3(0, 50, 0), startPos=self.spray.getPos(render) + Point3(0, 5, 0))))
        track.append(Wait(hold))
        track.append(Func(self.handleMiss))
        track.append(LerpScaleInterval(sprayScale, 0.75, GagGlobals.PNT3NEAR0))

        def hideSpray():
            (lambda prop: prop.removeNode(), [sprayProp, sprayRot, sprayScale])

        track.append(Func(hideSpray))
        track.append(Func(self.completeSquirt))
        return track
开发者ID:coginvasion,项目名称:src,代码行数:59,代码来源:SquirtGag.py

示例2: buildCollisions

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
 def buildCollisions(self):
     pieSphere = CollisionSphere(0, 0, 0, 1)
     pieSensor = CollisionNode('turretGagSensor' + str(id(self)))
     pieSensor.addSolid(pieSphere)
     pieNP = self.gag.attachNewNode(pieSensor)
     pieNP.setCollideMask(BitMask32(0))
     pieNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(pieNP, event)
开发者ID:coginvasion,项目名称:src,代码行数:13,代码来源:TurretGag.py

示例3: buildCollisions

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
 def buildCollisions(self):
     gagSph = CollisionSphere(0, 0, 0, 2)
     gagSensor = CollisionNode('gagSensor')
     gagSensor.addSolid(gagSph)
     sensorNP = self.gag.attachNewNode(gagSensor)
     sensorNP.setCollideMask(BitMask32(0))
     sensorNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(sensorNP, event)
     self.avatar.acceptOnce('gagSensor-into', self.onCollision)
开发者ID:coginvasion,项目名称:src,代码行数:14,代码来源:BigWeight.py

示例4: buildCollisions

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
 def buildCollisions(self, entity):
     pieSphere = CollisionSphere(0, 0, 0, 1)
     pieSensor = CollisionNode('gagSensor')
     pieSensor.addSolid(pieSphere)
     pieNP = entity.attachNewNode(pieSensor)
     pieNP.setCollideMask(BitMask32(0))
     pieNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.add_collider(pieNP, event)
     self.avatar.acceptOnce('gagSensor-into', self.onCollision)
开发者ID:coginvasion,项目名称:src,代码行数:14,代码来源:ThrowGag.py

示例5: buildProjCollisions

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
 def buildProjCollisions(self):
     gagSph = CollisionSphere(0, 0, 0, 1)
     gagSph.setTangible(0)
     gagNode = CollisionNode('projSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.gag.attach_new_node(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
开发者ID:coginvasion,项目名称:src,代码行数:16,代码来源:ActivateTrapGag.py

示例6: buildCollisions

# 需要导入模块: from panda3d.core import CollisionHandlerEvent [as 别名]
# 或者: from panda3d.core.CollisionHandlerEvent import set_out_pattern [as 别名]
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, self.collRadius)
     gagSph.setTangible(0)
     gagNode = CollisionNode('gagSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.gag.attachNewNode(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
     if self.isLocal():
         self.avatar.accept('gagSensor-into', self.onCollision)
开发者ID:coginvasion,项目名称:src,代码行数:19,代码来源:ActivateTrapGag.py


注:本文中的panda3d.core.CollisionHandlerEvent.set_out_pattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。