From the course: Unity Medical Visualization: 02 Animation and Coding

Setting up the hierarchy - Unity Tutorial

From the course: Unity Medical Visualization: 02 Animation and Coding

Start my 1-month free trial

Setting up the hierarchy

- [Instructor] In this section of the course, we're going to look at the incredibly fascinating subject of animation. We're going to be making the heart move to really indicate and bring our visualization to life so that we can see how this heart works. We're going to get started straight away by animating these arrow indicators here inside the heart. Now blood comes into the heart through the inferior and superior vena cava and this allows the body or the heart to capture blood from the body from the upper and the lower parts and it can pump oxidated blood through the entire system. Now to indicate this, we're going to be using these arrows that you can see here. But if we press play on the toolbar to take a look at the visualization, you'll see that really the arrows are completely static and stationary. We don't want to do that. We want to animate these arrows to indicate the direction of blood flow. Now have you take a look at the object here in the hierarchy panel, you can see that we have our heart object, the complete mesh itself. Now this object has several children. We have arrows one to six. Now the really interesting thing about this, at least for me in this project right here and it may be exactly the same for you, is that if you take a look carefully, you can only really see four arrows, one, two and three and four. And if I select these objects here, we actually have six. So there are two arrows that I'm missing. If I select, for example, Arrow6, you can see that we don't really see arrow six anyway and this is because the mesh renderer for this object is deactivated. I'm just going to enable the mesh renderer for that object and I'm going to in fact scroll through all of these objects to make sure that the mesh renderer for them all is activated so we can see all of the different arrows on this heart object. So here we have substantially more arrows that we can see. Now in the previous section of this course we configured the material to get these arrows to look exactly right. But what I want to do here is to stop animating these arrows. Now to do this, I'm going to configure the object slightly differently in the object hierarchy to optimize them for animation. To do this, I'm going to be selecting the heart prefab here. So just left click to select that in the project panel and then move to the object inspector and way, way at the top there, you can see the button that says Open Prefab. I'm going to select that which allows us to look at the heart object in isolation and we can make tweaks and changes to the hierarchy itself. So I'm going to grab the heart section, right click, choose Empty Object to create a new empty child objection. I'm simply going to name this Arrows here and I'm going to in fact divide these into the left and the right sides of the heart, so I'm going to right click again, choose Create Empty and I'm going to name this Right. Actually, I beg your pardon here, I just have to click inside the object to name that for the right. Right click Create Empty once again, rename this to Left. And I'm going to drag and drop the different arrows into those sections here. So five and six belong on this side of the heart, so I'm going to drag and drop those here on to the left side of the heart, beg your pardon. And I'm going to drag and drop those into the left side and grab arrows one to three and drag and drop those into the right side just to rearrange that hierarchy. We're not changing anything visually to this object here. We're just changing up the direction. Actually you can see in selecting the original heart prefab the arrows number six here and I think it was arrow number three have the mesh renderer deactivate. I'm just going to reactivate those objects. So now we have activated all the arrows and we have defined that these objects into a more sensible hierarchy that we're going to be using for animation. That's perfect. I'm going to exit the prefab here and you can see that in exiting the prefab, it has maintained the new hierarchal structure that I've added to this object. So we've gone ahead now and we have reconfigured this object to see all of the arrows and we've adjusted the hierarchy to optimize it for the animation we're going to be creating. And we're going to start creating that animation in the next movie.

Contents