Browse Source

Add kDynamicBlocker collider toggle.

Exports a collider that should hopefully block only dynamic objects (kickables). Also, some formatting adjustments to the properties script to match others (this can be undone if wanted)
pull/321/head
Patrick Dulebohn 3 years ago
parent
commit
7bc9e9833b
  1. 3
      korman/exporter/physics.py
  2. 55
      korman/properties/modifiers/physics.py
  3. 2
      korman/ui/modifiers/physics.py

3
korman/exporter/physics.py

@ -165,6 +165,7 @@ class PhysicsConverter:
physical.friction = mod.friction
physical.restitution = mod.restitution
if not mod.dynamic_blocker:
if mod.dynamic:
if ver <= pvPots:
physical.collideGroup = (1 << plSimDefs.kGroupDynamic) | \
@ -184,6 +185,8 @@ class PhysicsConverter:
_set_phys_prop(plSimulationInterface.kCameraAvoidObject, simIface, physical)
if mod.terrain:
physical.LOSDBs |= plSimDefs.kLOSDBAvatarWalkable
else:
physical.memberGroup = plSimDefs.kDynamicBlocker
# Hacky? We'd like to share the simple surface descriptors(TM) as much as possible...
# This could result in a few orphaned PhysicalSndGroups, but I think that's preferable

55
korman/properties/modifiers/physics.py

@ -69,18 +69,42 @@ class PlasmaCollider(PlasmaModifierProperties):
bl_icon = "MOD_PHYSICS"
bl_description = "Simple physical collider"
bounds = EnumProperty(name="Bounds Type", description="", items=bounds_types, default="hull")
avatar_blocker = BoolProperty(name="Blocks Avatars", description="Object blocks avatars", default=True)
camera_blocker = BoolProperty(name="Blocks Camera LOS", description="Object blocks camera line-of-sight", default=True)
friction = FloatProperty(name="Friction", min=0.0, default=0.5)
restitution = FloatProperty(name="Restitution", description="Coefficient of collision elasticity", min=0.0, max=1.0)
terrain = BoolProperty(name="Terrain", description="Object represents the ground", default=False)
dynamic = BoolProperty(name="Dynamic", description="Object can be influenced by other objects (ie is kickable)", default=False)
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)
bounds = EnumProperty(name="Bounds Type",
description="",
items=bounds_types,
default="hull")
avatar_blocker = BoolProperty(name="Blocks Avatars",
description="Object blocks avatars",
default=True)
camera_blocker = BoolProperty(name="Blocks Camera LOS",
description="Object blocks camera line-of-sight",
default=True)
dynamic_blocker = BoolProperty(name="Blocks Dynamics",
description="Object blocks dynamic objects (kickables)",
default=False)
friction = FloatProperty(name="Friction",
min=0.0,
default=0.5)
restitution = FloatProperty(name="Restitution",
description="Coefficient of collision elasticity",
min=0.0,
max=1.0)
terrain = BoolProperty(name="Terrain",
description="Object represents the ground",
default=False)
dynamic = BoolProperty(name="Dynamic",
description="Object can be influenced by other objects (ie is kickable)",
default=False)
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",
@ -119,8 +143,11 @@ class PlasmaSubworld(PlasmaModifierProperties):
options=set())
gravity = FloatVectorProperty(name="Gravity",
description="Subworld's gravity defined in feet per second squared",
size=3, default=(0.0, 0.0, -32.174), precision=3,
subtype="ACCELERATION", unit="ACCELERATION")
size=3,
default=(0.0, 0.0, -32.174),
precision=3,
subtype="ACCELERATION",
unit="ACCELERATION")
def export(self, exporter, bo, so):
if self.is_dedicated_subworld(exporter):

2
korman/ui/modifiers/physics.py

@ -20,6 +20,8 @@ def collision(modifier, layout, context):
split = layout.split()
col = split.column()
col.prop(modifier, "dynamic_blocker")
col.active != modifier.dynamic_blocker)
col.prop(modifier, "avatar_blocker")
col.prop(modifier, "camera_blocker")
col.prop(modifier, "terrain")

Loading…
Cancel
Save