diff --git a/src/nodes/PointingDeviceSensor/LookSensor.js b/src/nodes/PointingDeviceSensor/LookSensor.js
index 16537be..e00d0bc 100644
--- a/src/nodes/PointingDeviceSensor/LookSensor.js
+++ b/src/nodes/PointingDeviceSensor/LookSensor.js
@@ -3,6 +3,7 @@
* X3DOM JavaScript Library
* http://www.x3dom.org
*
+ * V4 additions (C)2016 Daly Realism, Los Angeles
* (C)2009 Fraunhofer IGD, Darmstadt, Germany
* Dual licensed under the MIT and GPL
*/
@@ -50,6 +51,16 @@ x3dom.registerNodeType(
*/
this.addField_SFString(ctx, 'description', "");
+ /**
+ * The description of the node. Currently unimplemented
+ * @var {x3dom.fields.SFString} description
+ * @range String
+ * @memberof x3dom.nodeTypes.LookSensor
+ * @initvalue ""
+ * @field x3d
+ * @instance
+ */
+ this.addField_SFString(ctx, 'objectClass', "");
/**
* Indicates if the node is enabled. An enabled node places a marker on the display. There can be only one LookSensor per scene.
@@ -100,23 +111,12 @@ x3dom.registerNodeType(
this.initDone = false;
- this.onTargetDuration = 2000;
- this.onTargetIncrement = 500;
- this.pollInterval = 200;
- this.regionSize = 14;
- this.timerId = 0;
- this.ShapeNode = null;
- this.currentLevel = 0;
- this.fireLevel = 4;
+ this.countdownInterval = 500; // >0 & in milliseconds
+ this.pollInterval = 200; // >0 & in milliseconds
+ this.regionSize = 14; // Needs to be consistent with CSS
- //route-able output fields
- //this.addField_SFVec3f(ctx, 'hitNormal_changed', 0 0 0);
- //this.addField_SFVec3f(ctx, 'hitPoint_changed', 0 0 0);
- //this.addField_SFVec2f(ctx, 'hitTexCoord_changed', 0 0);
-
-
//---------------------------------------
// PROPERTIES
//---------------------------------------
@@ -126,88 +126,143 @@ x3dom.registerNodeType(
// PUBLIC FUNCTIONS
//----------------------------------------------------------------------------------------------------------------------
+// --> Important not to initialze until all fields are defined. Also any change to the display
+// size needs to cause a reinitialization. Somehow that needs to be balanced against a
+// current countdown. Probably reset countdown in that case.
+
+// Changing certain fields during a countdown will not have an effect on the countdown (e.g., countdownTime)
+// Changes to the following fields resets the countdown
+// * objectClass
+// * enabled
+//
+// The target is only displayed when this node is enabled
+// Only one LookSensor can be enabled. If another LookSensor is enabled, this one is disabled.
+//
+// Logic for determining objects at scene center is wrong it needs to be similar to the following:
+// 1) Initial targeting
+// a) get list of objects at scene center
+// b) discard any that don't match the objectClass field value
+// c) Save list of matching objects
+// 2) Subsequent tracking (countdown)
+// a) get list of objects at scene center
+// b) keep going if any one of these matches the saved list
+// c) reset if no match
+//
nodeChanged: function () {
if (!this.initDone) {
- var worldId = this.findX3DDoc()._x3dElem.id;
- this.displayHeight = jQuery('#'+worldId).height();
- this.displayWidth = jQuery('#'+worldId).width();
- this.xCenter = this.displayWidth/2;
- this.yCenter = this.displayHeight/2;
- this.xTopLeft = this.xCenter - this.regionSize / 2;
- this.yTopLeft = this.yCenter - this.regionSize / 2;
- this.xBottomRight = this.xTopLeft + this.regionSize;
- this.yBottomRight = this.yTopLeft + this.regionSize;
- this.htmlAppend = "