Skip to content

Commit

Permalink
Small fixes for gizmo and navigation (BabylonJS#12603)
Browse files Browse the repository at this point in the history
* Small fixes for gizmo and navigation

* linter
  • Loading branch information
CedricGuillemet authored and alvov-evo committed Jun 16, 2022
1 parent 4dbd661 commit 3f0cc81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions packages/dev/core/src/Gizmos/gizmo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ export class Gizmo implements IDisposable {

// Rotation
if (this.updateGizmoRotationToMatchAttachedMesh) {
const transformNode = (<Mesh>effectiveNode)._isMesh ? (effectiveNode as TransformNode) : undefined;
const supportedNode =
(<Mesh>effectiveNode)._isMesh ||
effectiveNode.getClassName() === "AbstractMesh" ||
effectiveNode.getClassName() === "TransformNode" ||
effectiveNode.getClassName() === "InstancedMesh";
const transformNode = supportedNode ? (effectiveNode as TransformNode) : undefined;
effectiveNode.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion!, undefined, Gizmo.PreserveScaling ? transformNode : undefined);
} else {
if (this._customRotationQuaternion) {
Expand Down Expand Up @@ -364,7 +369,9 @@ export class Gizmo implements IDisposable {
}
// setter doesn't copy values. Need a new Vector3
light.position = new Vector3(this._tempVector.x, this._tempVector.y, this._tempVector.z);
light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);
if (light.direction) {
light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Navigation/Plugins/recastJSPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ export class RecastJSCrowd implements ICrowd {
*/
getCorners(index: number): Vector3[] {
let pt: number;
const navPath = this.recastCrowd.getPath(index);
const navPath = this.recastCrowd.getCorners(index);
const pointCount = navPath.getPointCount();
const positions = [];
for (pt = 0; pt < pointCount; pt++) {
Expand Down

0 comments on commit 3f0cc81

Please sign in to comment.