Help... How do I stop a script from running?
I have a script that runs once I tap a button ... the script listens for the users head to nod.
Everything is fine first pass through.
When I'm done I am calling event.enabled = false to stop the script and that works.
When I reset everything back to the main screen.. that initial button tap doesnt run the script. I put a print statement so I'm sure the script gets called.
-----
This is the script.
var nodSamples = [];
var runOnce = 0;
function update (eventData)
{
var headTransform = script.headBindingObject.getTransform();
var headForward = headTransform.up;
var headForwardNoY = new vec3( headTransform.up.x, 0.0, headTransform.up.z )
var dot = headForwardNoY.dot ( headForward );
if( nodSamples.length >= script.numNodSamples )
{
nodSamples.shift();
}
nodSamples.push( dot );
print("Checking for Nod")
checkForNod();
}
var event = script.createEvent("UpdateEvent");
event.bind( update );
It appears that isn't the whole script which makes it a bit hard to determine the cause