Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
You can also set up the onClick tool or the Interactive tool to change other types of variables beside Position and Rotation. You can also use it to change things such as the material of an object. Here we have that sofa that we were working with. It's called Sofa_01 and let's go ahead and change the color of the sofa by clicking on it. So I want to select the sofa, and just go into Dynamic Components > Component Attributes and again, we have the Sofa and we have the Cushions and the Base.
Now typically, we just want to change the material on the cushions and not the base. So I am going to go ahead and open this up and add the attribute for Material, similar to what we did before. And again, I can just type in any number of colors. So if I want it to be red, blue, purple, really whatever. Or if I wanted to I could go into the Materials window and just select whatever material I want from any one of these lists.
So whatever color I want or whatever sort of material I want. But let's go ahead and just deal with these basic colors. So now that I know that the material here can be changed to change the color, I need to add an attribute that changes that by clicking on it. So I am going to select onClick and then we need to add in a behavior. Well that behavior we can find in our Functions window. So let's go ahead here into Functions, use that pull-down list, and go down to onClick Functions.
Now, in this case we don't want to animate the couch. We want to change the material. So Alert, Animate, those don't work. The one we actually want to use is called Set, because we can set any attribute to any state. So let's go ahead and select that. So now I have it up here. But I need to put it into this field here. So I make sure that my cursor is in this field and hit Insert. So what we are going to do is we are going to set an attribute. So I am going to put that in quotes and the attributes we want to set is called Material.
So I want to make sure I have "Material" just like this and then all the different states. Now what the states are really is just the values that it will rotate through. So for example, I wanted to go for Red to Blue to Purple. So now what's going to happen is the first time you click on it, it goes red, then it goes blue, then it goes purple. This list can be as long as you want. You can put as many different types of materials in.
And again, the material naming conventions apply. All you have to do is either type in the name of the color, the hex value, or the material name of any material that's already in the scene. And once we have this set up, we can just hit Enter and it should work. Let's go ahead and interact with that. So now, I can click between all the different colors. Now this Set function works for Material but it can work for any other type of attributes. So you can actually set the number of copies, you can set Position, Rotation, that sort of thing or you can set any custom value.
So for example, if you want to click on it a number of times and change a different type of value for it such as the Quantity or the Price or something like that, you can do that as well. So as you can see the Interact tool can be used not only to animate things, but also change color and set really any other type of attribute you want. So the possibilities are pretty much endless.
Get unlimited access to all courses for just $25/month.Become a member
100 Video lessons · 12256 Viewers
83 Video lessons · 9741 Viewers
109 Video lessons · 5764 Viewers
56 Video lessons · 11795 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.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.