I need help with making a grab object.

(I don’t know what you call it) Okay so I was watching a video on youtube. (Where something was in FNV) and I happen to found this one video (I don’t know how it goes with fallout) and he was able to grab an object and drag/lift it… How do you do that?

Reason why I’m not trying this yet is because I don’t want to spend the day failing at this…or the next week…

EDIT: I think I need to change the name of this to “How to grab objects in BGE”…Too late, but that’s what I need help with.

Not as in power up grabbing, I just need help with the grabbing and dragging one…

an simple trick is to use a radar sensor and, lets say space, and if it is true to parent the object to your player, and do a xand for when to let go.

Finally got around to posting it!
EXAMPLE.blend (681 KB)

Um agoose77, what is the .blend suppose to do?

Oh. If you want a complete setup ill implement it.

why it many script?

I don’t have time to make a mouselooked example, but you’re capable with python, so you can probably figure this out. Holding the WKEY will pickup the object, and releasing drops it (paste this into the Script.py in the blend i posted, and delete the other scripts).
So, you can use a ray sensor looking for objects with a property pickup, and if that is true and you press P for pickup, it sets a property to true; and that is checked by the script and runs the code.
when you press p again it drops object by not running code.

import bge 

def moveObject(object_move, object_target, speed, gravity=False):
    '''Moves an object at a gradual rate toward target
    :param object_move: the object to move
    :param object_target: the object to target
    :param speed: the speed of movement
    :param gravity: to enable effect of gravity on object
    if not object_move or not object_target:
    if not gravity:
    start = object_move.worldPosition
    end = object_target.worldPosition
    last = end - start
    last += start
    object_move.worldPosition += (last - object_move.worldPosition) * speed

target = bge.logic.getCurrentScene().objects['Empty']
pickup = bge.logic.getCurrentScene().objects['Sphere']

if bge.logic.keyboard.events[bge.events.WKEY]:
    moveObject(pickup, target, 0.4)

Okay thanks.

http://www.heritems.info/avatar3.jpgFinally got around to posting it!

Okay it works, but how would I change it from WKEY to a Mouse left click?

I don't remember how to do this but, how would I make an object follow the mouse? (All I know is that it had a Ray Sensor...)

Found it on a video, but that was along time ago… (I think about 4 months ago…???)