Drag and Drop with Logic Bricks ?

Hello All,
I don’t have much experience with BGE but I’m messing around with the logic bricks (since I’m not a programmer) and it’s fun and friendly, I really like visual scripting.

Anyways,
I wonder if it’s possible to do this with Logic Bricks only:

  • Click on the shape I want (cube, plan, whatever…)
  • Drag the shape to anywhere and click to put the shape in the new position I chose.

A basic drag and drop to a shape where I can move them around the screen (no dynamics or gravity).

So… is it possible without Python and can you please help me out by direct me to a Video Tutorial or any other helpful way to learn how to do it?

Thanks ahead! :slight_smile:

  • Sorry about my bad English.

I don’t think it is possible to do without python because you have no way to get the location of the mouse or the distance it has moved. There is no option in the “Mouse” actuator for anything other than quickly setting up FPS look control or showing the mouse pointer. I do wish there was an option for a Mouse actuator that could store the relevant x,y, and wheel movements into properties - it seems like such an obvious thing to be able to do.

It is worth it to learn even the basics of python because you will be much more limited without it.

I have that

Simple mouse in resources

actually now that I read the Op post you want a pick and place script

edit: I will make a very simple python demo,
tonight’s

Drag&Drop by it’s nature is very dynamic. There are many different ways it can work. There is no logic brick handling such things for you. Therefore you need to create your own custom brick via Python.

Be aware that Drag&Drop usually consists of three phases:

  • begin drag
  • dragging
  • drop
    (- maybe a cancel option)

Thanks everybody for your kind explanations.
I’m still “scared” of Python, I tried to understand it… I guess my brain is not that good handling with programing code unlike with a friendly visual scripting that’s why I try to get into the logic bricks.

Now I start to understand that the Logic Bricks are not a complete solution for visual scripting in BGE, and that’s kind of sad for me… because I really started to like it since it’s so friendly.

Here is a mouse drag demo,

clicking a object with the property ‘Drag’ and holding it does a few things,

it moves the ‘Grab’ object to (9999,9999,9999)
it adds a imposture from layer 2(The imposture is the same object, but no collision)

releasing left click, moves the real object to the mouse.hitPosition, and deletes the imposture.

Attachments

MouseDrag.blend (465 KB)

Thank you very much for taking the time and making this example!
I just had a quick look and it’s great. Now I need to get the idea of the Python on the side… hehe :slight_smile:

You Rocks!

1 Like

the python is -> name sensors (click and mouse over)

if the sensors are positive and your target is a string , if the property Grab is in the object the mouse over hits,
set your property target as the game object (now it’s not a string) and add the imposture, move the target offscreen.

So now if the sensors are positive and your target is not a string (it’s a object) move the imposture where the mouse is hitting ( if you moved the game object, instead of the imposture it would get in the way of the mouse sensor and fly at the screen :D)

if your not clicking, and the target is not a string, place the original object, and delete the imposture.

blender 2.79
pick_place_vanilla_2_79.blend (527.6 KB)


upbge current
pick_place2b.blend (596.7 KB)

1 Like

I think that would make a great thread in the resources section. It would be a shame for someone that needs your solution to stumble across this thread and stop reading early because they saw the time stamps.

1 Like

done

1 Like