Trigger event from ground and activate the Object-child in the Camera

EDIT2: I can’t seen to get it working, can anybody create a simple script for me? As I told before, I have zero knowledge in scripting… I’m trying to learn.

EDIT: This is what I want to do… alt text

Hello, I’m making a atmospheric terror game, and I need help because I have little knowldge in scripting. I need to pick-up a flashlight from the ground, and I already got this working:

function OnTriggerEnter (myTrigger : Collider) {
	if( == "FPSPlayer"){
		Debug.Log("Flashlight Found");

It shows up right in the console, next thing I need is to add the flashlight to the hierarchy on the parent FPSPlayer (I use Ultimate FPS Camera). And make the flashlight on the ground disappear (This should be rather easy to do). Can anybody point me something?

Thanks everybody.

Sounds simple enough. I’m assuming the script I’m looking at is on your flashlight, is it? If so, you could try parenting the flashlight to the player.

Try replacing your debug statement with this:

transform.parent = myTrigger.gameObject.transform;

This should parent the flashlight to your player so that it moves with your player. Now you can just set the transform.localPosition and transform.localRotation to whatever it is you need to get it to look right.

Edit: Oooooh. That’s clever. Well, all you have to do then is call Destroy() on the Lantern on the ground, and then enable the one under your camera by using the enabled property.