diff --git a/korman/exporter/physics.py b/korman/exporter/physics.py index d13f221..4a4aa50 100644 --- a/korman/exporter/physics.py +++ b/korman/exporter/physics.py @@ -282,9 +282,16 @@ class PhysicsConverter: def _export_trimesh(self, bo, physical, local_space): """Exports an object's mesh as exact physical bounds""" - physical.boundsType = plSimDefs.kExplicitBounds - vertices, indices = self._convert_mesh_data(bo, physical, local_space) + # Triangle meshes MAY optionally specify a proxy object to fetch the triangles from... + mod = bo.plasma_modifiers.collision + if mod.enabled and mod.proxy_object is not None: + physical.boundsType = plSimDefs.kProxyBounds + vertices, indices = self._convert_mesh_data(mod.proxy_object, physical, local_space) + else: + physical.boundsType = plSimDefs.kExplicitBounds + vertices, indices = self._convert_mesh_data(bo, physical, local_space) + physical.verts = vertices physical.indices = indices diff --git a/korman/properties/modifiers/physics.py b/korman/properties/modifiers/physics.py index f561144..907875d 100644 --- a/korman/properties/modifiers/physics.py +++ b/korman/properties/modifiers/physics.py @@ -19,6 +19,7 @@ from PyHSPlasma import * from .base import PlasmaModifierProperties from ...exporter import ExportError +from ... import idprops # These are the kinds of physical bounds Plasma can work with. # This sequence is acceptable in any EnumProperty @@ -62,6 +63,11 @@ class PlasmaCollider(PlasmaModifierProperties): mass = FloatProperty(name="Mass", description="Mass of object in pounds", min=0.0, default=1.0) start_asleep = BoolProperty(name="Start Asleep", description="Object is not active until influenced by another object", default=False) + proxy_object = PointerProperty(name="Proxy", + description="Object used as the collision geometry", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects) + def export(self, exporter, bo, so): # All modifier properties are examined by this little stinker... exporter.physics.generate_physical(bo, so) diff --git a/korman/ui/modifiers/physics.py b/korman/ui/modifiers/physics.py index 615e476..fa9d8e9 100644 --- a/korman/ui/modifiers/physics.py +++ b/korman/ui/modifiers/physics.py @@ -39,6 +39,11 @@ def collision(modifier, layout, context): col.active = modifier.dynamic col.prop(modifier, "mass") + layout.separator() + row = layout.row() + row.active = modifier.bounds == "trimesh" + row.prop(modifier, "proxy_object") + def subworld_def(modifier, layout, context): layout.prop(modifier, "sub_type") if modifier.sub_type != "dynamicav":