Grabbing With The Mouse In The Ge

Hey guys I’m new to this forum, actually I joined because of a problem I’m having with using the mouse to grab items and dropping them in the GE. I don’t know Python and I really need a code can someone help???


well a simple python script could do this, first u probably want to see the mouse so make a script with this

 import Rasterizer as r

and if u r a noob then u must know that python IS case sensitive, make an always sensor and hook it up to a python controller with the name of ur script.
ill do the drag and drop script a little later

i already have the mouse showing but i need to be able to click on a object drag it and drop it somewhere else in the game


well im having more problems then i thought, i decided the easiest method would be to mod the mouselook script but its not that easy

Ive seen this done before… I think it was done with python.

I’ll be interested to see if you guys can do it though, its something im going to need in the very near future…

Edit Ive found a more recent one, but its not the one i was thinking of. Perhaps you guys could collaborate.

Hey there,

I love the inspiration so I made this, left click to pick up a box and release to drop it. It’s primitive and has no force applied to it so when you let go the box falls straight down instead of flinging away.

Hope this helps you (even though its done in python)


drag&drop.blend (137 KB)

well andrew 101 thats pretty good, i would go with that file errison as to mine will probably take a while to make, it will be better but still take a while, ill still post it if u would like.

Thanks, mine has a few problems though. Like if two boxes where in front of each other, it would pick up both of them instead of the closest. And if you move the mouse to fast while holding a box the box falls.

I’ll have a go at making a demo myself


I maybe have a solution…

If you could parent an object to the mouse (like an empty),
And then set the cubes you want to move to be:
Mouse Over - AND - Track to Empty
Mouse Over - AND - DLoc 0.2

Then when you put a mouse over a Cube the cube starts moving where the mouse goes,
until you move the cursor off the object.

Just an example.

Fort Ash

That seems ok, if you picked up a box and waved it around really fast youd drop it. :yes:

Im having an issue with your example though andrew101, sometimes it works fine. But most of the time when i click on the box it jumps to the side, just out of reach.

Really? It works fine for me. Make sure you don’t resize the 3D view or scroll the camera in or out or else it won’t work.

I would set it up like this (I’m no guru)

I would check and when the mouse.isPositive() and click.isPositive(): then get the mouseposition with getLocation (I think) and then use setLocation (or position) to the value of mouse.

That’s just what I would do.

Your idea killer is the one I tried first (it’s getPosition) but I can’t get it right. I know an alternate way that will work but it relies on making a different cursor thing. andrew 101 should know what I mean

Lol, that made no sense…

i already have the mouse showing but i need to be able to click on a object drag it and drop it somewhere else in the game


scaboostca made a grab-able windows !!!

thanks alot you guys ill try and work it out from here

You can also search for Kind0x tut. He had a drag system in which the object is dragged over any object with a little space in between. So if you hold the mouse above the nose of monkey, the obect is above is nose xD

(Hard to explain cause I **** in English but just look it up :p)

id go with the 3d gurus answer cuz unfortunately wwith the own.enableDynamics() and own.disableDynamics() bug (those python command dont work) i wasnt gonna be able to make a drag drop system that has a dyanmic object. so just go with the 3d gurus answer.