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( new Vector3().fromArray( pos ) );

					}

				}

			}

		} );

	}

}