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


Python TransformState.makePosHprScale方法代码示例

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


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

示例1: __init__

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
    def __init__(self, model, world, worldNP, pos, scale, hpr):
        self.worldNP = worldNP
        bulletWorld = world

        # Initialize the model.
        self.AIModel = loader.loadModel(model)
        self.AINode = BulletRigidBodyNode("AIChar")
        self.AIModel.setScale(scale)
        self.AIModel.flattenLight()  # Combines all geom nodes into one geom node.

        # Build the triangle mesh shape and attach it with the transform.
        geom = self.AIModel.findAllMatches("**/+GeomNode").getPath(0).node().getGeom(0)
        mesh = BulletTriangleMesh()
        mesh.addGeom(geom)
        shape = BulletTriangleMeshShape(mesh, dynamic=False)
        self.AINode.addShape(shape, TransformState.makePosHprScale(Point3(0, 0, 0), hpr, scale))
        self.AINode.setMass(0)
        bulletWorld.attachRigidBody(self.AINode)

        # Apply the same transforms on the model being rendered.
        self.AIModel.reparentTo(render)
        self.AIModel.setH(hpr.getX())
        self.AIModel.setP(hpr.getY())
        self.AIModel.setR(hpr.getZ())
        self.AINode.setAngularFactor(Vec3(0, 0, 0))

        # Attach it to the world.
        self.AIChar = self.worldNP.attachNewNode(self.AINode)
        self.AIModel.reparentTo(self.AIChar)
        self.AIChar.setPos(pos)
开发者ID:tbackus127,项目名称:AbominableSnowmanGame,代码行数:32,代码来源:SMCollide.py

示例2: __addConvexHull

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
    def __addConvexHull(self, body, model, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):        
        
        def one():
            geom = model.node().getGeom(0)          
            shape = BulletConvexHullShape()
            shape.addGeom(geom)
            body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
            return []

        children =  model.findAllMatches('**/+GeomNode') or one()

        model.flattenLight()

        for piece in children:
            shape = BulletConvexHullShape()
            geom = piece.node().getGeom(0)
            shape.addGeom(geom)
            body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:20,代码来源:physicsmanager.py

示例3: __addTriangleMesh

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
    def __addTriangleMesh(self, body, model, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1), dynamic=True):        
        
        mesh = BulletTriangleMesh()
      
        def one():
            geom = model.node().getGeom(0)            
            mesh.addGeom(geom)
            return []

        children =  model.findAllMatches('**/+GeomNode') or one()

        model.flattenLight()

        for piece in children:
            geom = piece.node().getGeom(0)
            mesh.addGeom(geom)

        shape = BulletTriangleMeshShape(mesh, dynamic=dynamic )
        body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:21,代码来源:physicsmanager.py

示例4: __addCapsule

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addCapsule(self, body, model, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     size = self.getSize(model)
     diam = max(size.x,size.y)
     shape = BulletCapsuleShape(diam/2, size.z-diam, ZUp)       
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:7,代码来源:physicsmanager.py

示例5: __addCylinder

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addCylinder(self, body, model, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     size = self.getSize(model)
     shape = BulletCylinderShape(max(size.x,size.y)/2, size.z, ZUp)
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:6,代码来源:physicsmanager.py

示例6: __addBox

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addBox(self, body, model, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     size = self.getSize(model)
     shape = BulletBoxShape( size/2 )
     body.addShape(shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:6,代码来源:physicsmanager.py

示例7: __addPlane

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addPlane(self, body, size=(0,0,1), pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     shape = BulletPlaneShape(Vec3(size), 0)
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale)  )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:5,代码来源:physicsmanager.py

示例8: one

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def one():
     geom = model.node().getGeom(0)          
     shape = BulletConvexHullShape()
     shape.addGeom(geom)
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
     return []
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:8,代码来源:physicsmanager.py

示例9: __addCone

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addCone(self, body, size, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     shape = BulletConeShape(max(size.x,size.y)/2, size.z, ZUp)
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:5,代码来源:physicsmanager+-+Copy.py

示例10: __addSphere

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addSphere(self, body, size, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     shape = BulletSphereShape( max(size)/2 )
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:5,代码来源:physicsmanager+-+Copy.py

示例11: __addTriangleMesh

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addTriangleMesh(self, body, geom, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1), dynamic=True):
     mesh = BulletTriangleMesh()
     mesh.addGeom(geom)
     shape = BulletTriangleMeshShape(mesh, dynamic=dynamic )
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:7,代码来源:physicsmanager+-+Copy.py

示例12: __addConvexHull

# 需要导入模块: from panda3d.core import TransformState [as 别名]
# 或者: from panda3d.core.TransformState import makePosHprScale [as 别名]
 def __addConvexHull(self, body, geom, pos=(0,0,0), hpr=(0,0,0), scale=(1,1,1) ):
     shape = BulletConvexHullShape()
     shape.addGeom(geom)
     body.addShape( shape, TransformState.makePosHprScale(pos,hpr,scale) )
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:6,代码来源:physicsmanager+-+Copy.py


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