First Person Controller Collisions

I’ve seen a ton of questions on this, I apologize on that mark. But I’ve been trying for quite awhile now and I simply can’t do it!

I have a first person controller prefab in my scene and just a simple sphere with a rigidbody. I want to be able to walk over the sphere and “pick it up.” That is to say, Destroy the object.

I’ve been tinkering with code similar to what’s in that link, but I’ve had no luck. I’ve loaded a new scene with that code on a script attached to the FPC, yet I still have no luck.

I’m new to unity, obviously, but this would be awesome to know.

First, you need to think about the logic you need. Do you want the object to detected the collision and then tell the player “Pick me up !” ( => OnTriggerEnter on the pickup ), or do you want the character controller to detect the collision and then pick it up ( => OnControllerColliderHit on the FPC ). I’d go for the second one, it makes more sense.

Both way, you end with the pickup and the player. The simplest thing you can do here is call Destroy( … ) on the pickup’s gameObject. That will only destroy it right away. Later, you’ll need to store it somewhere, but try to make the first step work.

Good luck.