How to move a physical object with the mouse?

Hello, I would like to make in my game a system of “physical cubes” that can be moved with the mouse (with the behavior “movable object” if possible or others)

Example of what I do:

  1. I move a cube that is on the floor with my mouse
  2. I move the cube in the sky with my mouse (in short it goes up)
  3. I release the mouse click which makes the cube go down by itself (gravity)

You will have to use the GD physics engine 2.0!
There should also be a “hitbox” between the cubes (no crossing cubes)

Anyway, I hope you understood my explanations and that you can help me!

I think this example of dragging objects with the mouse fits your requirements perfectly. If you add a second Player object to the scene, the one you drag collides with it, but won’t cross over it.

1 Like

Okay but how to fix the rotation of the object ? That is to say “how to make the object not rotate?”. Otherwise thanks for the example !

No I found ! Thank you very much !!!

1 Like