Posted this on unity answers and they told me that the this would be a better place to get some good answers, or atleast get a good debate going on peoples various ideas.
This is regarding 3rd person character setups
Say there are apples on the ground that the player wants to pick up how would the process go?
Should the apple have a trigger collider and be waiting to detect the player. Or should the player have a trigger and be waiting to detect the apple.
This also applies to interactions with doors and such. Should the player have a collider(or since doors are bigger a ray could be used) that when it is triggered will check the objects tag and tell the object to do it’s thing(for doors it would be to open and close and objects(like apples) it would be to be added to an inventory).
What are some other methods, and is there any big positives or negatives such as one is more performance expensive. Is one method better if the game is single player while another is better for multiplayer.
Depends on your code pattern - both are equally valid approaches, so pick the one you prefer. One is not necessarily better than the other. You probably want OnCollisionEnter so whenever the player touches something, the player can deal with that kind of object. Either way, the 2 objects need data about each other, and you can pass that with SendMessage if you’re only doing a few per frame.
Seems to my you’d have a lot more apples than players and you’d needlessly bog down the game with having the apple detect the collision. It’s also not logical as it would be something that wouldn’t react as a living thing would…but if you on children’s television and your apples do such things as talk and such then it’d make sense.
I completely agree with you. Just as I was looking around it seemed that allot more people favored having the apple do the detection instead of the player and so I thought I might have been missing some thing.
But I still wounder, is this how triple AAA games do there pick up system? I mean by just having a collision detection area for the objects as the base of the system. If it is then I am kinda blown away at how simplistic it turned out to be, at least in concept.