Hi! I am trying to create a surveilance cam in a fps like minigame test
The yellow light is just geomety, if you walk into it should trigger, play a alarm sound for 30seconds.
I tried two versions onTriggerEnter and onCollisionEnter
The Target would be the fps controler player object. So other things (enemies) do not trigger their own surveil.cams.
var player:GameObject;
var sound : AudioClip;
var soundVolume : float = 2.0;
function OnTriggerEnter(other:Collider) {
if (sound)
AudioSource.PlayClipAtPoint(sound, transform.position, soundVolume);
}
I don’t know if it has to be all this to play a audio or if just audio.play would be enought
And for the camera body a cript which moves it around
var dauer : int = 20;
var von : int = -150;
var bis : int = 90;
function Update () {
transform.eulerAngles.y = Mathf.PingPong(Time.time*dauer,bis) -150;
}
What i now need to figure out is how to let the alarm play for some time. And how to switch the Camera to keep looking at you as long as you are in its range.
It’s obvious i like MGS and this is just a little experiment in my freetime.
Shurely there is a better way to make a surveilance can, please tell me.