[x3d-public] TouchSensor disabling/enabling

roy.walmsley at gmail.com roy.walmsley at gmail.com
Fri Dec 3 02:52:28 PST 2021


Hi,

 

I have a Cupboard door prototype (EXTERN type) that has a TouchSensor node,
and Script nodes. I pass a field into the prototype a field to indicate
where, if at all, the door should hinge. A simple integer, 0 = no hinge, 1 =
left hinge, etc. I want to disable the TouchSensor when no hinge is
specified.

 

I already have a Script, with 'directOutput' set to true, that has an
initialize() function to set up other nodes for drawing, based on passed in
field data. So, I thought, why not add a simple check to this function, and
set the 'enabled' field of the TouchSensor appropriately. So I created a
Node field in the Script, and set the value to be a TouchSensor node, that
USEd the actual TouchSensor node. Then I set the 'enabled' field
appropriately in the initialize() function. This did not work. The
TouchSensor remains in the enabled state set in the node itself. I then
tried a second option, creating an outputOnly SFBool variable in the Script,
setting that in the initialise() function, and then ROUTEing that to the
'enabled' field of the TouchSensor. Still doesn't work.

 

So, I have two questions:

 

1.	Can a TouchSensor be enabled/disabled simply by a 'directOutput'
from a Script, particularly in an initialise() function? Or does it need an
actual event to change it?
2.	Do Script 'outputOnly' fields generate events when they are set in
an initialize() function?

 

Note I using X_ITE as a viewer. I've tried using X3D_Edit, but the Xj3D
fails miserably on a number of counts.

 

Thank you in advance,

Roy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211203/2ac80f06/attachment.html>


More information about the x3d-public mailing list