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.

update object list based on location

Home Forums General Questions update object list based on location

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #68051
    bigmike814
    Customer

    hello,

    My project has an option to load multiple objects onto the scene (could vary based on request) and I need to keep a list of the objects on scene and adjust the order based on location of let’s say the y-axis (horizontal). Let’s say we have object A B and C loaded. I want to show the distance from A to B, and B to C which isn’t a problem if I keep in that order. But if I move an object so now the order is C A B, I get into trouble because the order of my list wants to measure based on the original layout. I can use the sort numeric puzzle to sort location, but then I don’t have the object name that I’d need to adjust the order of the objects by name.

    https://v3d.net/pdf

    Does anyone have a solution or any ideas on how to approach this issue?

    Thanks in advance!

    Michael

    • This topic was modified 6 months, 1 week ago by bigmike814.
    #68053
    xeon
    Customer

    Well… I guess you have a couple of options.

    You can get the object name based on the last click…since your calculations are based on when the user drops / moves the last latest object.

    You can add a variable called LastClicked and assign the clicked object to it. Then you know which object was moved and can resort your list accordingly?

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #68056
    bigmike814
    Customer

    I have a draggedObject variable assigned that tells me what is moving/last item moved. I also have a list of nonDragged items and a list that adds a counter when items are added so I can loop through the list.

    I’m stuck on the logic needed to organize and update the list based on location.

    Attachments:
    You must be logged in to view attached files.
    #68061
    bigmike814
    Customer

    Wanted to update that I figured it out. I’ve included my solution if anyone is ever researching a similar issue in the future.

    • This reply was modified 6 months, 1 week ago by bigmike814.
    • This reply was modified 6 months, 1 week ago by bigmike814.
    • This reply was modified 6 months, 1 week ago by bigmike814.
    #68067
    kdv
    Participant

    If you save positions and names to a dictionary you can easily restore the names after sorting.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #68072
    bigmike814
    Customer

    Nice solution. I ended up coming up with a different solution that seems to work, but I’ll try yours out.

    Here’s what I came up with. I tried to post the code, but it was rejected. We’ll see if this works.

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