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.

‘Picked object’ but for picked group

Home Forums Puzzles ‘Picked object’ but for picked group

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #46309
    Jack Seymour
    Customer

    Hi All,

    Wondering if anyone has been able select a subgroup within a group to be used with on ‘when clicked’ puzzle? For example, as per blender screenshot attached, I want to be able to select a sub group (ie room 1.1, room 1.2, etc…) from the main group ‘Rooms’and when clicked it gets the room that is being hovered over and hides everthing else.

    Currently, you can see with in the puzzle screenshot attached that i’m trying to use ‘picked object’ – which only ever returns one mesh. The reason for seperate meshes between room and walls is that I want to be able to hide all walls, hence why I also have a seprate collection called ‘walls’ with the wall meshes linked in.

    Here is what I imagine some of the possible fixes to be:
    1) In puzzles set up the logic for the individual subgroups and get rid of the larger ‘Rooms’ collection. This however might be too much effort for a project with hundreds of rooms.
    2) There is a way to way so retrieve selected subgroup instead of mesh.
    3) If there is a way based on my naming convention to find similar object names ie. (all objects with “1.1” in their name)
    4) Combine seperate meshes into one and use materials as a way to hide certain parts of the mesh (this may mean duplicating a lot of shared materials – tanking performance from extra shaders)
    5) Give up on wanting to hide the walls entirely haha!

    I’m currently doing this as a proof of concept so if anyone could let me know how far off the mark I am that would be greatly appreciated!

    Attachments:
    You must be logged in to view attached files.

    https://discord.gg/vGMAAED
    Join the Verge 3D Discord Server!
    plz share Discord link & on your signature!

    #46313
    xeon
    Customer

    Interesting problem but solvable I think. For a small number of rooms, like your sample the answer is simple but if you are planning on doing hundreds of rooms the problem is far more complicated.

    Going to work on this a bit and see if I can find a solution for lots of rooms.

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

    #46324
    xeon
    Customer

    OK… I have figured out a solution…not the only one as I am sure there are some bright minds on here that could have done this differently. This may not even work for your needs or may need to be modified…I have no idea.

    I started thinking what if the number of objects was in the thousands and what if someone just made a mistake placing the right object in the right collection or just forgot to put it in a collection. Sorting through thousands of objects would be horrific and reviewing the collections would just take too long to even want to think about.

    I think the biggest issue is separating the difference between blender Collections and Verge. Collections are representations of organization and yes you could do it that way but using the same principles in the attached application but Verge is based on objects but so you can create lists of objects that represent a group/collection and then you are set.

    First I had to pick a file name schema. I hate spaces in names so I modified yours to be mesh_Walls_1. and mesh_Room_1. With the incrementer being the last character.

    Then from there I just created two text strings based on object names using the schema. Once the text strings were created, I converted those to a lists: wallList and roomList.

    Then went to the onclick event for allobjects and depending on the name of the object clicked it hides the appropriate lists and shows the item that was clicked on.

    The Blue sphere is just a reset so you can do try it out.
    The other spheres were just remnants from the initial scene build.

    Hope this helps.

    Attachments:
    You must be logged in to view attached files.

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

    #46338
    Jack Seymour
    Customer

    Thanks for all the effort you have put into this! Really appreciate it. Having played around with your solution a bit it seems I was getting a very similar result to the what I had, as in I still couldn’t select a room and its walls together.

    However, what you example has shown me is that you can call objects (for show/hide) by using their name in a string. Therfore with a bit of renaming of the of the objects I can acheive what I wanted with much simpler puzzles! In the attached I’ve added the suffix ‘_walls’ to wall objects, and append that onto the end of picked object. Screenshots of this attached.

    On another note, I was having a browse through the developer reference wiki and came across this for objects:

    .groupNames : Array
    An array specifying groups this object belongs to. Used for grouping/referencing collections of objects.

    Wondering if this could be exposed through puzzles (not a developer so not a clue if/how this would be done) but might be really helpful in certain instances like these.

    Attachments:
    You must be logged in to view attached files.

    https://discord.gg/vGMAAED
    Join the Verge 3D Discord Server!
    plz share Discord link & on your signature!

    #46345
    xeon
    Customer

    Ok I was unclear on your functional logic

    So what you need is

    If a user selects meshwall1 that all objects are hidden except for room1 and wall1? If so that can be easily added using puzzles.

    I will send a screen shot when I get to work.

    GroupNames is fully available using JavaScript

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

    #46346
    Jack Seymour
    Customer

    Ah okay yes. What I have in my last reply is working well but if there is a more efficient/better way of doing it i’m all ears!

    I spose the next step of this is to find out whether its possible to select subgroups of subgroups? Different put, is there a way to select any group in a collection heirachry?

    Seems like i need to learn some Javascript! :mail:

    https://discord.gg/vGMAAED
    Join the Verge 3D Discord Server!
    plz share Discord link & on your signature!

    #46348
    xeon
    Customer

    Here is a puzzle solution that lets the user select a wall and it will hide everything except the group its in. Or you can select a room and it will hide everything except the group its in.

    Attachments:
    You must be logged in to view attached files.

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

    #46351
    Jack Seymour
    Customer

    Is that still dependant on how you name the objects? for example if there is 10 objects in a group do you have to add all of the to the list and name them correctly?

    https://discord.gg/vGMAAED
    Join the Verge 3D Discord Server!
    plz share Discord link & on your signature!

    #46352
    xeon
    Customer

    This example is based on the naming of the objects. In this case, there are two groups: mesh_Walls_1. and mesh_Room_1. Then the sub-groups are designated by the last character in the object name. mesh_Walls_1.1 where the last character “1” is sub-group 1.

    In this example, I did not account for groups greater than a single digit. This will accommodate groups 0-9. So if you need groups with digits greater than 1, there would need to be some additional manipulation to get the groupNum and ObjectLength.

    So what I would do is make sure all your objects have a naming structure that is a defined “length” before the “.” Example: mesh_Walls_1. = 13 characters and mesh_Room_1.=12. So I would rename all the mesh_Walls_1. to mesh_Wall_1. So that the naming of the objects are all 12 characters long.

    Then you could get the length of the picked object and subtract 12 from it to determine the length of the GroupNum. Once you have the length of the GroupNum you can then loop through the string to pull the GroupNum value and then the rest of the puzzles would work.

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

    #46353
    xeon
    Customer

    The picture of the attached puzzles will handle any character length after the “.” So you could have mesh_Wall_1.1209887676.

    You will have to change the naming of the objects to be a consistent name length… in this example, I set the name_length to 12.

    I also did not modify the naming of my objects so you will need to do that in your blend file…then also make changes to all locations where I have created the text strings and rename all those locations to match your new name schema.

    Attachments:
    You must be logged in to view attached files.

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

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