本文整理汇总了Python中panda3d.bullet.BulletRigidBodyNode.setTransform方法的典型用法代码示例。如果您正苦于以下问题:Python BulletRigidBodyNode.setTransform方法的具体用法?Python BulletRigidBodyNode.setTransform怎么用?Python BulletRigidBodyNode.setTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.bullet.BulletRigidBodyNode
的用法示例。
在下文中一共展示了BulletRigidBodyNode.setTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: genHand
# 需要导入模块: from panda3d.bullet import BulletRigidBodyNode [as 别名]
# 或者: from panda3d.bullet.BulletRigidBodyNode import setTransform [as 别名]
def genHand(self, handz=100.0):
# fgr0
boxx = 5.0
boxy = 2.0
boxz = 20.0
boxpx = 0.0
boxpy = 10.0
boxpz = handz
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('fgr0')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
# fgr1
boxx = 5.0
boxy = 2.0
boxz = 20.0
boxpx = 0.0
boxpy = -10.0
boxpz = handz
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('fgr1')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
示例2: addWalls
# 需要导入模块: from panda3d.bullet import BulletRigidBodyNode [as 别名]
# 或者: from panda3d.bullet.BulletRigidBodyNode import setTransform [as 别名]
def addWalls(self):
"""
add walls
:return:
"""
# x+
boxx = 2.0
boxy = 50.0
boxz = 100.0
boxpx = 50.0
boxpy = 0.0
boxpz = 50.0
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('Wallx+')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos = [boxpx, boxpy, boxpz], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
# x-
boxx = 2.0
boxy = 50.0
boxz = 100.0
boxpx = -50.0
boxpy = 0.0
boxpz = 50.0
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('Wallx-')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos = [boxpx, boxpy, boxpz], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
# y+
boxx = 50.0
boxy = 2.0
boxz = 100.0
boxpx = 0.0
boxpy = 50.0
boxpz = 50.0
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('Wally+')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
# y-
boxx = 50.0
boxy = 2.0
boxz = 100.0
boxpx = 0.0
boxpy = -50.0
boxpz = 50.0
shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
node = BulletRigidBodyNode('Wally-')
node.addShape(shape)
node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
self.bltWorld.attachRigidBody(node)
pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
# shape = BulletPlaneShape(Vec3(0, 0, 1), 0.0)
# node = BulletRigidBodyNode('Ground')
# node.addShape(shape)
# np = self.base.render.attachNewNode(node)
# np.setPos(0, 0, 0)
# self.bltWorld.attachRigidBody(node)
self.handz = 200.0