How to fix this? I want to add a small cube collider on my character feets that play the sound and emit some dust particles when they collide to ground. So far I got the sound working but the emitter part is still bit tricky. Since the compiler gives me the error “Node ‘self.emitter.Emit’ has not been correctly processed.” System should be keeped simple as possible since my modeller is not too much for coding. Keep It Simple for Stupid.
var Terraincollider : Collider;
private var stepSound : AudioSource;
private var emitter : ParticleEmitter;
@script RequireComponent (Rigidbody)
function Start()
{
stepSound = gameObject.GetComponent(AudioSource);
if(!stepSound)
Debug.LogError("FootCollider " + name +" is missing foot sound!");
emitter = gameObject.GetComponent(ParticleEmitter);
if(!emitter)
Debug.LogError("FootCollider " + name +" is missing step emitter!");
else
emitter.Emit = false;
var rg = gameObject.GetComponent(Rigidbody);
if(rg)
rg.isKinematic = true;
}
function OnTriggerEnter(col : Collider)
{
if(col.collider == Terraincollider)
{
stepSound.Play();
emitter.Emit = true;
yield WaitForSeconds(0.05);
emitter.Emit = false;
}
}
What I am missing here?