Now let's take a look at one more use of the Interact tool and that's to set any attribute you want using the tool. So, we're going to start with this couch and we're going to change the color of the couch. Now, this is a couch we used before, so if you remember, if we go into our Components Attributes window, you'll see that we have a main sofa and then we have a sub component for the cushions and the base. And so, what we want to do is, change the color of the cushions.
Now, previously, we did this using a drop down list, but let's use the Interact tool this time. So, we're going to go into Sofa Cushions and we're going to add an attribute. Let's go ahead and start by adding an attribute for Material. Now, if you recall, you can type in the name of a color, or the name of any material in your scene. So, if I were to type in say, Blue, the couch will turn blue. Or, I can go into my Materials window, and pick the name of really any color in the scene, and use that as well.
But, I'm just going to stick to named colors here, just to make it simple. So, if we want, we could say we want the material blue, or we could say purple. That's another material we could use. We could also use something such as gray, G-R-A-Y. And so, we have a number of different colors we can use, so let's go ahead and use the Interact tool to cycle between these. So, I'm going to go ahead and add attribute, and just like we did before, I'm going to use the On Click attribute, and this time the function that we want, is not going to be the animate function.
Let's take a look at the other functions that we can use, so I'm going to insert a function here. And let's scroll down to the On Click functions. Well, we don't want to send an alert, we're not really animating anything. We don't need to go to a scene or redraw anything, but we do need to do is to set an attribute. In this case, we need to set material. Let's select Set and insert that into the field. So, we're going to set an attribute here. Well, what attribute are we going to set? We're going to set Material.
I'm going to go ahead and make sure that Material is in quotes. And then I'm going to hit a comma, and then everything else is really just the names of the colors. So we're just going to cycle through the colors that we want. And then it can be any number of colors. But in this case, let's go ahead and cycle through Blue, Purple and Gray. So, once I have that, I'm going to hit Enter. And it seems to like it, so let's go ahead and hit Interact. And you can see, I can interact with the couch and when I click on it, it goes from color to color to color.
Now again, you don't need to limit yourself to three colors, you can put as many as you want and you can also put in the names of materials that are within the scene. So, as you can see, the On Click attribute can be used to move objects, but it can also be used to set any attribute that you have within the scene.
Get unlimited access to all courses for just $25/month.Become a member
100 Video lessons · 12002 Viewers
56 Video lessons · 11362 Viewers
83 Video lessons · 9309 Viewers
109 Video lessons · 5142 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Your file was successfully uploaded.