Help with physics

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Heys guys!

    Does anyone know how to drag and drop physic objects, while keeping the collisions?

    Thanks in advance ;)

  • What method are you currently using?

    I may be able to help if I have a little more information about what you have already tried, as not to recover the same ground.

    ~Sol

  • What method are you currently using?

    I may be able to help if I have a little more information about what you have already tried, as not to recover the same ground.

    ~Sol

    Well, I tried to use "set force towards position", with the mouse coordinates, but the object keeps moving around the mouse. I suppose it needs some math calculations which I'm not good at :P

    And if I use the drag'n drop behavior it doesn't collide with other Physic objects while dragging...

  • I would try something like:

    + Hold mouse button down

    + Mouse is over object

    -->Set private variable "is dragging" to 1

    +Private variable "is dragging" equals 1

    --->Set object.X to Mouse.X

    --->Set object.y to Mouse.Y

    +Hold mouse button down (negated so it's a NOT)

    --->object set private variable "is dragging" 0

    That should work.

    ~Sol

  • if I use the drag'n drop behavior it doesn't collide with other Physic objects while dragging...

    I've tried it and it works

    You can still pull it through the immovable objects, though.

  • I would try something like:

    + Hold mouse button down

    + Mouse is over object

    -->Set private variable "is dragging" to 1

    +Private variable "is dragging" equals 1

    --->Set object.X to Mouse.X

    --->Set object.y to Mouse.Y

    +Hold mouse button down (negated so it's a NOT)

    --->object set private variable "is dragging" 0

    That should work.

    ~Sol

    Thanks but i've already tried that. The problem is, you can only use physics events to move the object, otherwise they will not collide and that's what I really need... :(

  • Anyone?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could try destroying the object on click, and then creating a dummy that doesn't use physics.

    Then on mouse release, destroy dummy, create physics object.

    Trigger once is your friend.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)