本文整理汇总了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)
示例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) )
示例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) )
示例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) )
示例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) )
示例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) )
示例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) )
示例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 []
示例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) )
示例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) )
示例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) )
示例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) )