Skip to content

Commit 5eaeb32

Browse files
authored
Merge pull request #512 from Candoran2/develop
Two small fixes including #499
2 parents 6c43b75 + 085b06a commit 5eaeb32

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

io_scene_niftools/modules/nif_export/collision/havok.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def export_bhk_rigid_body(self, b_obj, n_col_obj):
173173
n_r_body.restitution = b_r_body.restitution
174174
n_r_body.max_linear_velocity = b_obj.nifcollision.max_linear_velocity
175175
n_r_body.max_angular_velocity = b_obj.nifcollision.max_angular_velocity
176-
n_r_body.penetration_depth = b_obj.collision.permeability
176+
n_r_body.penetration_depth = b_obj.nifcollision.penetration_depth
177177
n_r_body.motion_system = b_obj.nifcollision.motion_system
178178
n_r_body.deactivator_type = b_obj.nifcollision.deactivator_type
179179
n_r_body.solver_deactivation = b_obj.nifcollision.solver_deactivation

io_scene_niftools/modules/nif_import/collision/havok.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _import_bhk_rigid_body(self, bhkshape, collision_objs):
197197
b_r_body.deactivate_angular_velocity = mathutils.Vector([ang_vel.w, ang_vel.x, ang_vel.y, ang_vel.z]).magnitude
198198

199199
# Custom Niftools properties
200-
b_col_obj.collision.permeability = bhkshape.penetration_depth
200+
b_col_obj.nifcollision.penetration_depth = bhkshape.penetration_depth
201201
b_col_obj.nifcollision.deactivator_type = NifFormat.DeactivatorType._enumkeys[bhkshape.deactivator_type]
202202
b_col_obj.nifcollision.solver_deactivation = NifFormat.SolverDeactivation._enumkeys[bhkshape.solver_deactivation]
203203
b_col_obj.nifcollision.max_linear_velocity = bhkshape.max_linear_velocity
@@ -269,7 +269,11 @@ def import_bhkconvex_vertices_shape(self, bhk_shape):
269269
# find vertices (and fix scale)
270270
scaled_verts = [(self.HAVOK_SCALE * n_vert.x, self.HAVOK_SCALE * n_vert.y, self.HAVOK_SCALE * n_vert.z)
271271
for n_vert in bhk_shape.vertices]
272-
verts, faces = qhull3d(scaled_verts)
272+
if scaled_verts:
273+
verts, faces = qhull3d(scaled_verts)
274+
else:
275+
verts = []
276+
faces = []
273277

274278
b_obj = Object.mesh_from_data("convexpoly", verts, faces)
275279
radius = bhk_shape.radius * self.HAVOK_SCALE

io_scene_niftools/properties/collision.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ class CollisionProperty(PropertyGroup):
8282
items=game_specific_col_layer_items,
8383
)
8484

85+
penetration_depth: FloatProperty(
86+
name='Penetration Depth',
87+
description='The maximum allowed penetration for this object.',
88+
default=0.15
89+
)
90+
8591
deactivator_type: EnumProperty(
8692
name='Deactivator Type',
8793
description='Motion deactivation setting',

0 commit comments

Comments
 (0)