本文整理汇总了Python中panda3d.bullet.BulletWorld.remove方法的典型用法代码示例。如果您正苦于以下问题:Python BulletWorld.remove方法的具体用法?Python BulletWorld.remove怎么用?Python BulletWorld.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.bullet.BulletWorld
的用法示例。
在下文中一共展示了BulletWorld.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BulletBase
# 需要导入模块: from panda3d.bullet import BulletWorld [as 别名]
# 或者: from panda3d.bullet.BulletWorld import remove [as 别名]
#.........这里部分代码省略.........
objs = objs.itervalues()
bw_objs = []
for obj in objs:
if isinstance(obj, NodePath):
obj = obj.node()
if isinstance(obj, self.bw_types):
bw_objs.append(obj)
# Don't attach ones that are already attached.
bw_objs = set(bw_objs) - set(self.bodies)
# Attach them.
for obj in bw_objs:
# Warn about deactivation being enabled.
if (not suppress_deact_warn and
getattr(obj, "isDeactivationEnabled", lambda: True)()):
msg = "Deactivation is enabled on object: %s" % obj
warn(msg, DeactivationEnabledWarning)
# Apply existing axis constraints to the objects.
self._constrain_axis(obj)
# Attach the objects to the world.
try:
self.world.attach(obj)
except AttributeError:
DeprecationWarning("Upgrade to Panda3d 1.9.")
for attr in ("attachRigidBody", "attachConstraint",
"attachGhost"):
attach = getattr(self.world, attr)
try:
attach(obj)
except TypeError:
pass
else:
break
def remove(self, objs):
""" Remove Bullet objects to the world."""
if not self.world:
raise BulletBaseError("No BulletWorld initialized.")
# Make sure they're iterable.
if not isinstance(objs, Iterable):
objs = [objs]
elif isinstance(objs, dict):
objs = objs.itervalues()
bw_objs = []
for obj in objs:
if isinstance(obj, NodePath):
obj = obj.node()
if isinstance(obj, self.bw_types):
bw_objs.append(obj)
# Remove them.
for obj in bw_objs:
# Remove the objects from the world.
try:
self.world.remove(obj)
except AttributeError:
DeprecationWarning("Upgrade to Panda3d 1.9.")
for attr in ("removeRigidBody", "removeConstraint",
"removeGhost"):
remove = getattr(self.world, attr)
try:
remove(obj)
except TypeError:
pass
else:
break
def remove_all(self):