setLookAtProperties method

dynamic setLookAtProperties(
  1. dynamic model,
  2. Map modelNode
)

Implementation

setLookAtProperties(model, Map modelNode) {
  if (modelNode["LookAtProperty"] != null) {
    var children = connections[model.id].children;

    children.forEach((child) {
      if (child.relationship == 'LookAtProperty') {
        var lookAtTarget = fbxTree.objects["Model"][child["ID"]];

        if (lookAtTarget.Lcl_Translation != null) {
          var pos = lookAtTarget.Lcl_Translation.value;

          // DirectionalLight, SpotLight
          if (model.target != null) {
            model.target.position.fromArray(pos);
            sceneGraph.add(model.target);
          } else {
            // Cameras and other Object3Ds

            model.lookAt(Vector3().fromArray(pos));
          }
        }
      }
    });
  }
}