Skip to content

Commit

Permalink
Merge pull request #265 from kaliber5/fix-target
Browse files Browse the repository at this point in the history
Fix setting initial target for TargetCamera
  • Loading branch information
simonihmig authored Sep 14, 2020
2 parents 4c5d8b3 + ef9cfb1 commit ae72bda
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/systems/camera/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ export default class TargetCameraSystem extends FactorySystem<
protected create(c: TargetCamera): BabylonTargetCamera {
assert('CameraSystem needs BabylonCoreComponent', this.core);

const { position, ...rest } = c;
const { position, target, ...rest } = c;
const { scene } = this.core;
const instance = new BabylonTargetCamera(TargetCamera.name, position ?? Vector3.Zero(), scene, false);
assign(instance, rest);
const camera = new BabylonTargetCamera(TargetCamera.name, position ?? Vector3.Zero(), scene, false);
assign(camera, rest);
if (target) {
camera.setTarget(target);
}

return instance;
return camera;
}

update(entity: Entity): void {
Expand Down

0 comments on commit ae72bda

Please sign in to comment.