- This topic has 8 replies, 4 voices, and was last updated 5 months ago by visualizer.
-
AuthorPosts
-
2024-06-16 at 10:19 pm #74886BrameisterParticipant
Hello everyone,
I’ve come across an issue that I can’t seem to solve. I have objects (in this case, they are bars) that are copied/cloned multiple times and connected among each other.
The issue is that I need a puzzle to make sure that when I click any of the bars, the clicked bar is set as the “active bar”, for several purposes. However, the cloned items have dynamic names, and the following puzzle I created for the “when clicked” puzzle doesn’t work:
The issue is the create text puzzle used instead of the standard object name string.
At first, I thought the issue was the fact that the ActiveLayer variable is a number, but in S8S’s documentation for the “create text” puzzle, they say that “If you provide non-textual values such as numbers, they will be automatically converted to text”. Plus, I’ve been using this structure to set dynamic object names everywhere else in this project and had no issues.
If the issue is the concatenation of string+number, is there any way I can convert the variable’s number value into a string? Or is the real issue something else completely unrelated?
2024-06-16 at 11:56 pm #74891xeonCustomerYou may find this helpful.
https://www.soft8soft.com/docs/manual/en/puzzles/Events.html#picked_object
Best when used with when click and all objects. You can create a if statement to insure the object name suffix is correct then take action
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-17 at 12:49 am #74892BrameisterParticipantIt really amazes me how easy this is for you guys I’m a huge fan of you and kdv!
Thanks so much for the help, Xeon. Worked like a charm, so simple and sophisticated solution.
2024-06-17 at 4:32 am #74894xeonCustomerNo problem… glad I can help. This forum has helped me so much it’s the least I can do. I am still learning too.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-17 at 11:35 am #74910BrameisterParticipantFor future reference and other people that may struggle with this like I did, here’s what I came up with after Xeon’s awesome insight:
2024-06-17 at 11:39 am #74911kdvParticipantIf your scene have several other objects except the cloned bars then it won’t work correctly if you click on one of those objects. Add some logic to filter the bars by their names…
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.
2024-06-17 at 11:52 am #74912BrameisterParticipantIf your scene have several other objects except the cloned bars then it won’t work correctly if you click on one of those objects.
Thanks for the input, kdv! There is only one original bar object, from which all of the clones are made. It’s the “starting bar” so to say and I also need it to be the active bar when it is clicked. So, I think it will work, right? But the notion of adding logic will certainly be extremely useful in the future.
Thanks again to both of you V3D gurus!
2024-06-17 at 7:58 pm #74916xeonCustomerSince you are using the “all objects” puzzle…you will want to validate the user has not clicked on something else other than the required objects. In my example below I am assuming;
the original objects name has the word “bar” in its name and that no other objects in your scene have the word “bar” in their name. If so this will work.Because their could be other objects in your scene that are not clones…any object you click on will return the name of the clicked object. This may or may not be what you want. So this logic ensures only the objects with names with the word “bar” in them will execute your command to print to console.
Attachments:
You must be logged in to view attached files.Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-18 at 5:05 pm #74945visualizerCustomerHey Polypix
interesting learning
Can you share the end result achieved by using this setup? -
AuthorPosts
- You must be logged in to reply to this topic.