Skip to content

Commit 9947039

Browse files
committed
Fixed bug in Displacement Correction for objects with custom matrix
1 parent 746fcd3 commit 9947039

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

kk_bullet_constraints_builder.zip

67 Bytes
Binary file not shown.

kk_bullet_constraints_builder/builder_prep.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,8 +1285,12 @@ def applyDisplacementCorrection(objs, objsEGrp, connectsPair, connectsLoc):
12851285
if grpDCor:
12861286
grpName = elemGrp[EGSidxName]
12871287
for obj in grpsObjs[grpName]:
1288+
inv_matrix = obj.matrix_world.inverted()
12881289
for vert in obj.data.vertices:
1289-
vert.co -= Vector(vLocData[vIdx])
1290+
current_world_loc = obj.matrix_world *vert.co
1291+
corrected_world_loc = current_world_loc -Vector(vLocData[vIdx])
1292+
local_corrected_loc = inv_matrix * corrected_world_loc
1293+
vert.co = local_corrected_loc
12901294
vIdx += 1
12911295

12921296
# If changes have been made

0 commit comments

Comments
 (0)