Skip to content

Commit

Permalink
Fix navmesh child object scaling and position
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumCoderQC committed Feb 24, 2024
1 parent 8a39eb3 commit 9d36417
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/armory/trait/NavMesh.hx
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,22 @@ class NavMesh extends Trait {
vertexIndexMap = generateVertexIndexMap(vecind, vertexMapArray);

// Parented object - clear parent location
/*
if (object.parent != null && object.parent.name != "") {
object.transform.loc.x += object.parent.transform.worldx();
object.transform.loc.y += object.parent.transform.worldy();
object.transform.loc.z += object.parent.transform.worldz();
object.transform.localOnly = true;
object.transform.buildMatrix();
}
}*/

var positions = fromI16(geom.positions.values, mo.data.scalePos);
for (i in 0...Std.int(positions.length / 3)) {
v.set(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2]);
v.applyQuat(object.transform.rot);
v.x *= object.transform.scale.x;
v.y *= object.transform.scale.y;
v.z *= object.transform.scale.z;
v.x *= object.transform.scale.x * object.parent.transform.scale.x;
v.y *= object.transform.scale.y * object.parent.transform.scale.y;
v.z *= object.transform.scale.z * object.parent.transform.scale.z;
v.addf(object.transform.worldx(), object.transform.worldy(), object.transform.worldz());
positions[i * 3 ] = v.x;
positions[i * 3 + 1] = v.y;
Expand Down

0 comments on commit 9d36417

Please sign in to comment.