Skip to content

Commit

Permalink
Merge pull request #3085 from t3du/FixSoftBodyHooks
Browse files Browse the repository at this point in the history
Fix: Softbody and Cloth Hooks
  • Loading branch information
luboslenco authored Nov 28, 2024
2 parents bcb47e1 + 5508bc1 commit fd56e2e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/armory/trait/physics/bullet/PhysicsHook.hx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PhysicsHook extends Trait {
function init() {
// Hook to empty axes
target = targetName != "" ? iron.Scene.active.getChild(targetName) : null;
targetTransform = target != null ? target.transform : object.transform;
targetTransform = target != null ? target.transform : iron.Scene.global.transform;

var physics = PhysicsWorld.active;

Expand Down Expand Up @@ -107,9 +107,9 @@ class PhysicsHook extends Trait {
// Find nodes at marked vertex group locations
var numVerts = Std.int(verts.length / 3);
for (j in 0...numVerts) {
var x = verts[j * 3] + sb.vertOffsetX;
var y = verts[j * 3 + 1] + sb.vertOffsetY;
var z = verts[j * 3 + 2] + sb.vertOffsetZ;
var x = verts[j * 3] + sb.vertOffsetX + sb.object.transform.loc.x;
var y = verts[j * 3 + 1] + sb.vertOffsetY + sb.object.transform.loc.y;
var z = verts[j * 3 + 2] + sb.vertOffsetZ + sb.object.transform.loc.z;

// Anchor node to rigid body
if (Math.abs(nodePos.x() - x) < 0.01 && Math.abs(nodePos.y() - y) < 0.01 && Math.abs(nodePos.z() - z) < 0.01) {
Expand Down

0 comments on commit fd56e2e

Please sign in to comment.