Home › Forums › General Questions › update object list based on location
Tagged: item order, list, sorting
- This topic has 5 replies, 3 voices, and was last updated 1 year ago by bigmike814.
-
AuthorPosts
-
2023-10-29 at 5:38 pm #68051bigmike814Customer
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.
Does anyone have a solution or any ideas on how to approach this issue?
Thanks in advance!
Michael
- This topic was modified 1 year ago by bigmike814.
2023-10-29 at 6:46 pm #68053xeonCustomerWell… 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.com2023-10-30 at 12:28 am #68056bigmike814CustomerI 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.2023-10-30 at 4:29 am #68061bigmike814CustomerWanted 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 1 year ago by bigmike814.
- This reply was modified 1 year ago by bigmike814.
- This reply was modified 1 year ago by bigmike814.
2023-10-30 at 10:04 am #68067kdvParticipantIf you save positions and names to a dictionary you can easily restore the names after sorting.
Puzzles and JS coding. 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 the meaning at all.
2023-10-30 at 12:37 pm #68072bigmike814CustomerNice 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. -
AuthorPosts
- You must be logged in to reply to this topic.