HL2 object pickup

If anyone here has ever played half life 2, you’ll notice that you can goa around picking up pretty much any object that a human is capable of.

I would like to do this in blender. So basicly what i want is for when the camera gets close enough to an object and presses ‘E’, i want that object to become parented to the camera.

How would i do this?

Do a search, this was discussed recently.

yes this was recently discussed, however the examples where not useful. i would also like to know how to do this so if there is anyone who could provide any bit of ‘useful’ information, then thanks in advance for the help.

could someone who knows how to do this please provide a sample?

I don’t know what exactly you want to achive. A usual way to pick up things is that you have two equl items. One on the ground and one in the hands. But only one is visible.

Initialy only the item on the ground is vissible. When the character picks up the item it becomes invisible (or will be removed completely). The item in the hand is going to be visible. Check for the Monkey Island demo. Here you see that main character carries all item but invisible.

attach a near sensor, a keyboard sensor, a tracking actuator, and a movement actuator to the object.
if you are close enough to the object, and when you press the key, the object tracks and moves towards you.

example: http://home.comcast.net/~thedecrepitery/pickup-obj.zip

Here try this one on for size:
It’s a simple first person demo. Doesn’t have anything fancy like a mouse look script but one could be added.
Mouseover and left click the ball to “grab” it.
When the ball is grabbed you can throw it with the right mouse button.
And that right there is basicly the first level or two of HL2 LOL!
Future games I make will have sweet physics and functionality like this, I’ll mess with it more once we have Char support (which makes me exited, it will be awsome)
You could play around with this file; changing the bounds, the flying speed of grabbed objects, making a bunch of duplicates of the object or making different objects with the same logic bricks, or even changing the engine.
Have fun!