We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Stop dragging when touch other objects

Home Forums Puzzles Stop dragging when touch other objects

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37602
    Petro
    Customer

    I am not sure if I should use physics module, or play without it in order to have control over few cubes which I drag and arrange in a room. I did not found a simple dragging physics objects example but without physics I already managed to drag objects…
    Not sure how to know when should stop dragging in order to not drag through other objects. Maybe to keep a dictionary with x, y, z position of objects or I should better investigate with physics ?

    #37613
    Petro
    Customer

    I get X position for an object and is it output as -0 instead of expecting 0. This look strange for me. Any hint please ? :scratch:

    #37626
    GLiFTeK
    Customer

    Hi,
    You can look into applying a Box3 to your object(s) and see if they intersect.

    I have a custom puzzle for that.
    I will be premiering soon if you can wait.
    I’ll let you know!
    :good:

    #37646
    Petro
    Customer

    As I drag objects on xy I did calculate for now, the x,y coords for each box corner and compared based on 3D Collision Detection … however something is not perfect and I get a console print “Collision detected with object …” but if I continue dragging “stronger” I get over the “barrier”. Any ideea how to stop dragging somehow… any trick ? I now restore the x,y for the dragged object to initial state… :scratch:

    #37652
    Petro
    Customer

    I did it in a function GlifTek which I call in the puzzles. Not know how to make yet a puzzle from it but it works… I will need to cleanup my code :) Took all [[x,y]… 4 corners and compared :) Thx for opening my eyes :yahoo:

    #37658
    GLiFTeK
    Customer

    You can circumvent all that extra code with Box3. It creates an AABB for you.
    You’d use intersectsBox

    But if you got something else working then awesome! Don’t need to fix what is not broken!

    :good:

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.