I am new to javascript. I am executing the following unity script. I am getting the NullReferenceException on line 32. I will greatly helpful if anyone could identify the problem.
#pragma strict
import ThinksquirrelSoftware.Fluvio.Emitters;
var accelerometerUpdateInterval : float = 1.0 / 60.0;
var lowPassKernelWidthInSeconds : float = 1.0;
var shakeDetectionThreshold : float = 2.0;
internal var emitter : FluidEmitter;
private var lowPassFilterFactor : float = accelerometerUpdateInterval / lowPassKernelWidthInSeconds;
private var lowPassValue : Vector3 = Vector3.zero;
private var acceleration : Vector3;
private var deltaAcceleration : Vector3;
function Start()
{
shakeDetectionThreshold *= shakeDetectionThreshold;
lowPassValue = Input.acceleration;
}
function Update()
{
acceleration = Input.acceleration;
lowPassValue = Vector3.Lerp(lowPassValue, acceleration, lowPassFilterFactor);
deltaAcceleration = acceleration - lowPassValue;
if (deltaAcceleration.sqrMagnitude >= shakeDetectionThreshold)
{
Debug.Log("Shake event detected at time "+Time.time);
} else {
Debug.Log("Shake event NOT DETECTED ");
**emitter.Emit();**
}
}