UE5 Tutorial: Interactive Doors and Windows - Full System | Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello hello hello and welcome welcome to my little capsule this video is a small part of my tutorial series called interactive architecture where I'll be showing you how you can make all sorts of different things with Unreal Engine today we'll learn how you can interact with objects in the most visually well let's say minimal way notice as I'm moving my camera sometimes the little e button appears and that appears only when I'm hovering over an object with which I can interact just like so so that's what we're going to be doing in this tutorial let's jump right into it okay let's go so the first thing that we need to do to make this whole thing work is create an interact button basically any keyboard button that you press would act as a opening button for the windows the doors whatever have you so I will go to settings project settings right here this menu pops up and here on the left hand side under input I'll navigate to Action mappings under bindings sorry under action mappings I will add a new action mapping by pressing this button right here I'll name it interact and in this case I'll just press this little keyboard icon here and then press my e key e as in electricity right so this this button right here enables me to kind of add any keyboard key or by just hitting it and that's much more convenient than trying to find the correct Key by just scrolling down but you can do it this way as well that's fine anyway now we have our interact button mapped you don't need to save this you can just close it it's already here in our project then the interaction like reading if they interact button has been pressed that is handled by your character within your character blueprint so under content under third person blueprints here you'll find your third person character blueprint you double click that it opens up your event graph as well as your viewport you know all of these tabs I assume you're at least slightly familiar with them and in my character blueprint I already have a toggle perspective action where this isn't previous video you can just check that one out when I press the shift key it toggles between the first person camera and the third person camera but it's not about this so now I want a new action and that action is going to be how did we interact right so I'll just right click anywhere where on empty space on the screen and I'll type in interact and you can see here input action events interact that's highlighted and just click it and this little node pops in so this node means that whenever we press the E button the interact button something will start happening right so what happens well we need to um when we press the button we need to make sure that we're looking at the object that we want to interact with right that is important that we are looking at the object so I'm going to create a node that's called line Trace line Trace and there's like a lot of different variations of this but for us we want line trees by Channel and we'll use the visibility Channel you know the looking at Channel right here I will not go deep into different channels and so on just make sure that you're using visibility for this one and it should you should be good to go okay so when the interact button is pressed line Trace meaning just a line straight from your from somewhere to somewhere actually not necessarily from your eyes is going to be drawn and it's going to check if it hits anything right so what we want to do is we want the line to be drawn from camera along the direction in which we're looking at and it needs to hit or or it needs to check if it hits a door or a window or I don't know a table so that you can kind of flip and flop them so that the table or the door that was hidden inter interacts right starts rotating so I need the start of the vector of the direction and I need the end so basically I need to determine the looking at angle right so to do this I will get my camera in here and I'll use my third person camera the follow camera for this like that and for that camera I will get its location because that's where the our eyes are third person camera or set no wait sorry uh get get I'm stupid get world location there we go we're getting the location of the camera so that's where the start of our Vector is and then we need to get the end of our Vector which is a little bit more difficult but even somewhat easy to do all we need to do is get World rotation so to understand how that camera is rotated and then from it we can just draw draw a vector from that rotation I believe it's forward Vector get forward yes get forward vector there we go and basically it's going to draw you know according to how camera is located rotated it's going to draw a vector the problem with it is that the vector is very small it's just one centimeter long one unit long so I will drag off from here and I'll just type in the multiply button or icon not symbol symbol multiply symbol this one multiply there we go and I will multiply it by a value in this case it asks me for a vector I don't want to give it a vector so I'm going to right click on this input here and I'll convert it to a float or you can do integer as well if you want to but I'll use a float single Precision number float means it has digits after the comma integer means it doesn't have digits after the comma right it's full numbers for integer so I'll just multiply it by let's go for 10 meters so uh a thousand centimeters is 10 meters yeah yeah it is okay so now we have a pretty long last Vector that's drawn from our eyes and ends here right so our start is our eye location and the end is the end of this vector okay um let's change the draw the bug debug debug type to persistent right here or for duration if you want to but I'll just use persistent let's compile this save this go back to our game and just press play and press the E button and you can see that wherever I'm looking at as I'm pressing the E button I'm shooting this red things and the once they interact with something or hit something they become green because that's how unreal shows you that it it has managed to interact with something and all of these lines are 10 meters long that's the length of our Vector right so we have our first component to the calculation right to to making sure that we're only opening up stuff that we're looking at now we're checking if we're looking at the problem is that once I change the well it's still kinda works but not really when once I changed the perspective now it's not really hitting where I'm looking at it's not really shooting where I'm looking at right it's shooting somewhere else that's because it's still using the third person camera even though I'm in the first person mode right so I need to go back in here and I need to make sure that it's shooting from the correct camera right it's using the correct camera right here for the line trees so when the key is pressed there needs to be a branch going on right where just follow along I will explain it once we do it so we create a branch like that and the condition for the branch and for now I'll just disconnect this so that we're clear of what's going on so we press the button and it can either go out as true or false and the condition for that is US asking is the follow camera I'm just dragging it over right here is the follow camera is it active is active like that is it active and I added to the condition okay so the way this works is if the follow camera the third person camera if that is active then it's going to trigger the true statement here and it's going to use the line Trace generated here right let me just drag this over a little bit so it's going to use the line Trace generated from the follow camera clearly but if the follow camera let me just if you click on the sorry if you double click on the line you can then create this kind of a small little Dot and it just makes things cleaner so that that's what I did here if the follow camera is not active that means the first person camera is active that that means it should shoot out from false and all I'm gonna do is I'm just gonna take this all of these nodes Ctrl C Ctrl V copy paste paste them here connect pulse to the line Trace right here right and instead of using here the follow camera instead of using the follow camera delete I will use my first person camera if you're only using the follow camera the third person camera and you don't have the first person camera then you don't really need to follow these steps you don't need a branch you can just straight up connect it to a single line Trace but in this case we need to kinda the side right which one are we using there's better ways of doing this but this one is visually the easiest to explain I guess okay so once this is done let's compile save play just to make sure that it works um e e okay in this case wherever I'm shooting that is indeed the yeah that that's what I'm looking at that works and then for shift if I let's say I'm looking at the corner right here oops yeah there we go corner right there yeah that that seems like it's it's doing the thing okay great um I want to lock down the how do you call it the perspective not perspective uh the the um aspect ratio of the cameras but I will do that later for now I know that this works and I will change this both of these draw debug types from persistent to for duration so after a while they disappear right later down the line we will just not even draw them because we won't need to okay so once that is done then we need to create another statement okay what happens when you hit a thing right when you're looking at something and you hit it well you need to create a branch here and you need a like a condition right so condition is going to be the the return value basically saying I've hit it or I I haven't hit it any hit than anything that's the condition and for on hit we basically need to um read what was it that what we hit right so it comes out here out hit we need to break it break hit result we need to expand this and the the thing that we will use is called Hit actor right basically it's once we look at something and we do the interact button it's going to draw the line it's going to check if it hit anything if yes then this is going to trigger and it's going to always spit out which actor was it or Which object was it from here from the hit actor button or output okay now we need a way of how we can take this data this information and we need to transfer it to an actor right to an actor that has been hit that this is where it gets well not necessarily tricky but where we need to do a little bit of shenanigans with a little bit more complex concept of blueprint interfaces right so the way we do this is we go to back to our project and we will just create maybe under content I'll just create a new folder call and call it blueprints just blueprints just my own little blueprints open that up and here right click blueprints and blueprint interface we'll create this one right I'll just call it um how do I call it interact BP interact blueprint right it basically takes an information and lets through information through itself to other blueprints so it's like a that holds information think it just think of it this way right inside of the BP blueprint or sorry in interact blueprint here there's really not not much that you that you need to do it it just kind of reads the information and passes it through so we're just gonna we're just gonna have it the way it is I'm just the function that it's gonna use I'm just going to rename it right here to interact just to keep things consistent right so the actual function function of the blue blue print is called interact that's all we need to do we compile we save we close it we never think about it ever again it's just a cup right back in here back in our third person character blueprint I will click on this class settings gear icon thing and under was it under interfaces there we go I will add an interface and I will find my interact blueprint interface interact BP that's the name of the blueprint that we have just created man like that now if I expand it here on the right left hand side I will see my interact function right that's the function that we have created in our interact blueprint so it's basically a cup that's empty that's waiting for for us to fill it up with information or a cup that's full that is waiting on us to read the information from okay so the interact blueprint I'll just drag it in here this function was not marked as blueprint capable and cannot be placed on the graph um do we need to one second I need to think I actually didn't need to think didn't need to do anything I just needed to right click type in interact and access it through here rather than by dragging it interact with a message right like this it's going to have this kind of a little post icon here so okay when something is hit then we read which actor was actually hit like that right easy peasy once this is done I will just minimize this right to make it more Compact and I'll repeat it for the my first person camera exactly the same process branch rendition break expand Direct if it's hit if it's true then read what was it the functionality is initially the same compile save we're done we're done with this setup right here I will just select all of it t as in comment and name this interact with line phrase oh I wrote it here okay since this is done I can compile this I can save this and now we can move on to our next step so actually the next step is going to be us creating the door and I will be creating something very well this is lagging what's up with that um I will be creating something very very simple uh just a door that's now it's alive um a single box that rotates for testing and once we're done that then we will get into here and we will actually make the let's see the table open up or maybe the window open up something like that so in terms of the door I will um access my blueprints folder right here and here I'll just create a new uh blueprint from blueprint class right here and it's going to be an actor and I'm just going to say testing door like that double click that and here you have your viewport of the actual blueprint you have your event graph of what happens with it and construction script we will not be using the construction script but we'll be using the viewport and event graph so in the viewport I need an object here so I'm just going to click on the add button and I'll just find a cube whatever just a cube something like this looks fine and for the cube I will scale it I will scale it by well not in X or actually yes in X so in X I want it to be smaller 0.5 oh uh make sure that this is unlocked so let's do actually 0.2 by 1 by 2. yeah something like that seems to be okay I don't really need it to be acting like a door or anything like that we always will need this for it to just kind of rotate so this is fine with me just a big box and then one more thing is going to be me adding a scene so add scene like this scene um when I add the scene you can see since I had the cube selected it becomes uh parented to the cube so it becomes a child of my Cube I don't want it so I will just drag the scene into my default scene root and wait attach I believe it's yeah I'll just attach it to my default scene root so that it's not the scene that is a child of the cube but rather the cube is a child of the scene why am I doing this well that's because the scene is actually going to be my favorite Point pivot pivot pivot my Pivot Point it's going to be a point around which the Box will rotate so I'm just going to oops actually need to move it this is this is weird but I actually need to move it before I parent the cube to the pivot point so I'm just going to take the cube move it to default scene root attach so that again these are equal and all I'm doing is just creating a hierarchy here right and I'm just going to move the Pivot Point first so that's the point again F to zoom in that's the point around which my box will rotate and if the snapping is too obnoxious you can always disable it right here but I will use it right here something like that so that's going to be the the point and we're going to be rotating around the set axis okay once that is done once I have moved the point I will take the cube and I will move it back into the Pivot Point and now you can see if I take the pivot point and I rotate it right here the cube rotates together with it that's the plan right now it's on to event graph for us so we will not be using any of these events that are already here we don't care what we care about is the interact event right the event that we used as what's the name oh my God I'm stupid I'm blanking out the blueprint the blueprint the interact blueprint that we have created let me dock it here that we have created here that's what we're going to be using to actually read right but the thing that we're going to be doing is we'll go to the class setting right here and we will add the interpiece of course because it needs to understand that it needs to use the interact interface that we have created so under implemented interfaces again I find that interact BP this one now it's added in and now I can right click here and type in event interact wait why is it not here hello yet again I'm being stupid all I needed to do I forgot too many things to remember is just double clicking the interact here and it literally just places the node for us so you need to double click it and then it works okay yikes anyway so once we have um this interaction going on we need to ask if the door or in this case yeah let's call it the door the cube or the door is it currently open right and if it is then it needs to be closed but if it's not open if it's currently closed it needs to be opened right so we will be doing a branch range here and the condition is actually going to be I'm sorry it's going to be a variable like that and we will call the condition the variable condition um F2 to rename we'll rename it to is or just door open door open if yes then this is it needs to be closed if no or rather let's do a door closed now let's keep the door open sorry if if closed it needs to be opened if opened it needs to be closed okay then we need to animate the opening of the door of course right so does it open in a linear way or does it open slowly at first then it ramps up in speed and then slows down before it gets to the let's say 90 degrees or does it is it really aggressive you can control that oops you can control that in unreal which is very nice but for that we need the timeline so from true I'll drag out and I'll create a timeline timeline um add timeline right here bam and let's call it um door timeline probably misspelled that doesn't matter we have our uh play that is connected to true I will holding the Ctrl key or ALT key doesn't matter I'll disconnect it and actually true will go into reverse and false will go into play why is that well that's because if door is open then as the timeline plays um it needs it needs to close so it needs to go in reverse right so if the ore is open go in reverse if door is closed then then indeed go and open it so play the timeline we need to actually um create the timeline now so I'll double click on it this is our timeline menu click on track to add a new track and a little add float float track that's going to be a float track like this I'll call it a door open track and here I'm just going to create two points um wait dude add e here and add key here it doesn't matter where where you add those keys because we will be messing with them right so the first key is going to be at the first game the time for it is going to be at zero so at the start of the you know animation zero that's where where it starts and the value is going to be zero right no rotation was oh God damn it zero and and zero if you wanna zoom into them you will need to use these uh these two little icons here but that's later so zero and zero zero and the next one is going to be basically we need to think how long do we want the animation to be to take and how much of an opening value do we want to have in degrees so the time let's say the door opens in one and a half seconds 1.5 this is for the second Point while the value is 90 degrees 90 and now it's somewhere way off from our view from our screen so I'm just going to click Zoom to fit vertical and zoom to fit horizontal these two buttons and now it's back back on track back and not back being normal then this is too linear so the door will just open up as if it has no weight to it so we need to add weight I will right click on my first node here and I'll choose rather than linear I'll go for uh Auto yeah yeah it's Auto isn't it I think it's Auto let's let's go for auto sure and for the second one I will right click it and choose Auto as well so both of them I have this kind of a curvature that you can also control with the handles if you want to but let's let's keep it as default this tutorial is already pretty long a compile save I don't need to use the timeline anymore so we close it we have all that we need right right here okay so back uh back with us playing with the door um I do need to set a rotation right now from this timeline so it's going to spit out um variable here the door open variable is going to be a number that's going to be spit out and I will make a rotator from it make rotator rotate or like that and the question is which axis do we rotate around well it's going to be that right because yeah I'm not going to explain that figure it out it's going to be a Texas so we rotate around that axis and we also will so that means the animation is updating so from this I'll drag out and I will say set relative that's not how you write relative relative rotation and it asks me for which is it the cube is it the default scene root or is it the pivot point it's actually going to be the pivot point right we're rotating the hinge and the cube is just gonna follow so that that's why we created the Pivot Point the actor there and I just connect the return value basically the rotation to the new rotation here we're almost done well with this part we're almost done with this part the last bit is actually measuring if the door is open or closed for this we will need event pick so we will be measuring at the speed of the processor well not really but let's just say at the speed of the processor it takes off the processor if the door has been opened or closed um which means that when this value door open value I'll just drag away from it when this is larger then let's say one degree one degree right here then this variable door open variable I'll just drag from it like that I will set it this variable needs to be set like so uh to be opened or closed okay um if zero that means it's closed if it's even slightly more than zero that means it's open right so if this is larger if this value is larger than 1 then this is true and or open becomes true Okay so if there is at least a single digit of of an angle for the door this will be true and since this is true then it's going to play the reverse and it's going to next time you press e it's gonna close it yay we compile we save we go into our little playground we press play we forgot to add the door into the actual scene so let me just drag it in like that press play and now I'm just shooting around you know nothing happens but I shoot at the door and it opens and I shoot at it again okay let me do it this way and it doesn't close why oh never mind it closes that was weird that it didn't close properly also my angle of shooting is very messed up I will need to fix that yeah hey it works it does open and close okay one second I'll I'll see why my my rotation is off wait a second okay I figured it out so like an idiot I forgot to actually move the vector onto the eyes so it kept being drawn from zero zero zero that's one thing so let's fix it the way you fix it is quite simple all you do is just to add the location Vector together with your direction Vector to get the correct and position right so I'll just drag off from here and we're in character blueprint by the way add these two add it to the end now it's gonna work and do the same thing here to the end that's gonna work if I compile save press play we do need to actually yeah that's gonna be fine e you can see that now wherever I'm looking at it's actually shooting with this is going to be easier why are you not displaying oh because false is not connected to here compile save again yeah there we go directly in the middle of the screen and which means that now open door closed door Open Door closed door the thing is that um sometimes it doesn't really interact that that well if you don't do one thing with the input action button and that is the consume input tick mark here so if this is Tick marked so you just select the interact button if this is Tick marked consume and put a stick Mark then you press play and I'm gonna look at the door interact interact okay now it works okay so sometimes it doesn't work so if you have like a glitchy interaction going on just make sure to check you know I've consumed input that might need to be removed unticked right and that's gonna fix it anyway let's move forward now we have our kind of working working system the only thing that is left to do to make this whole thing work is get a little bit of a icon a little bit of like press e to interact type of a thing and for that um I will create an icon myself in Photoshop it's not going to be part of the tutorial because I'm sure you you'll be able to do it yourselves but it's gonna be like 20 by 20 pixels a small little e right here I'm gonna pause the video and start it again once I'm done okay it's done so I have created this interact e a little button 20 by 20 pixels in Photoshop I can use any literally anything you want to create that little image and I have just took it created a new folder called icons and dragged it over into that folder that's it so now to actually push it on the screen we need a blueprint right we we need to create a widget so to say that slaps information for the user on top of the screen so I'll right click here user interface and I'll just create a widget blueprint um actually let me create a new folder and call it in widgets I like to keep things tidy and then here I user interface which is blueprint and uh the user which is extensible by users through the widget blueprint okay user widget sure like that uh once that is done I will just give it a name interact Dot widget something like that double click on it to open it up this little menu or not menu but do the widget opens and here I will need to find a scene I believe uh one second I need to check my notes now it's called canvas canvas canvas panel there we go so I'll take it and I'll drag it down into this oh sorry I'll drag it down into this widget so now the canvas is created and then besides the canvas I can go in here find my icons that's in the main file a folder whatever under icons I have my image and I believe if I just drag it over to my widget here and just slap it in yeah that works that works just fine so now with this added you can see canvas panel and image 0 is here but that added I will go for size so I'll determine it's the size that is 20 by 20 that's what I created and for position X and Y I actually need to Anchor it to the center so this is the center anchor you can see here and you will notice that if even if I zero them out right now it's still not like it's still not centered properly because it uses the top left corner as its anchor so I'm just going to if it's 20 by 20 then X needs to be minus 10 and Y needs to be 10. nope also minus 10 to be centered now it's right in the middle of the screen no matter the size of the screen compile save we're done so this is already good to go you know a little icon that's gonna pop up I will close this I'll go back to my character blueprint and I will implement it I will make the widget show up in on our screen every time when we are looking at an object that we can interact with should it be on the character or should it be on the door itself that's the question it should probably be on the character right um anyway uh at least for the character for sure for the character we will need to um event begin play When We Begin play so we'll need to kind of continue on with this logic here I'll drag it up we need to create the widget right for within our character so I will say that when we begin playing we will set our follow camera as our active camera that's the first thing that we do so follow camera I'll just drag it in here and I will set active set it set it as active [Music] um no that's stupid let's let's do that later sorry sorry let's do that later instead let's just create create interact how did I call it widget create widget create widget and for the class we will find our interact dot widget like that okay so it's created it's not pushed on the screen but it is created and we will set it as well I believe we should okay so let me just make this into a variable so you right click on the output and you set it as a variable and I'll just name it um interact.widget like that right so we created and we set our interact.widget as uh our this variable as our widget variable which means that now we can control its appearance according to us either looking at stuff that we can interact with or not looking at stuff that we can interact with right so that that's what we're going to be doing now uh switching that appearance so to do so we need to constantly measure the uh which view are we looking through is it the first person or the the third person and also what we're looking at so this little icon right here or not icon node right here which is interact button that we have the E button that doesn't work anymore because it only measures when we press the button in this case it needs to be real time so we use event thick and with event tick it's going to shoot out the line Trace at every frame of our animation so I'm going to use LINE Trace again line trees by Channel and I'm going to basically it's going to be the same um the same process as as here so honestly what we can do this might be not a good idea or it might be a great idea what we can do is we can optimize this so I'm gonna show you how another way of how you can optimize for two different cameras for this you would need to create a new variable and call it ack if camera active camera variable right like that wait there we go and the active camera variable needs to be a camera component so you go here camera component expand that oh come on again camera component not seeing a camera just camera component object preference so you get that then a this active camera will be able to switch and I'm just dragging it over here and saying get active camera this active camera component will be able to switch between a first person camera or third person camera depending on which one is currently active how do you write into it which one is currently active well it's here where we have our functionality to switch cameras again if you're not familiar with this script right here check out the other video that I've done a link in the video description of how you can get this to work holding the shift key to switch the views but basically after we set the cameras uh to to be active then we can also see um just one second I need to double check yeah so since first person camera becomes active here then my active camera is going to be set to be the first person camera get that so I set active camera and I get first person camera right and vice versa right if my follow camera is active then I set my active camera to be my follow person camera which I can't find there it is follow camera get like that bam so this variable that we have created will now flip flop between the two cameras that we have depending if of the toggle right one little problem that we will need to fix in the near future is that at the start of the play of the game it's not going to have any input so it's gonna have it's gonna be empty and this is gonna freak out because of it but we will fix it quite easily so just don't don't you worry about that anyway from here on out it's pretty straightforward it's the same process as what we've done here where we got the world location rotation vectors multiplied and added them up so I'm going to do that real quick right now get World location get rotation uh World rotation get forward vector multiply by a float float and I believe I used a thousand you can use like any large number and add this up so that's a plus sign that I used and we just the location is the start the added vectors are the at the end and now we have a line Trace with debug mode set to for duration for now for now right if I press compile save and press play here you'll notice that only after I press the shift button does it start tracing where I'm looking at and now it's Gonna Keep tracing but let me escape and there is a bunch of Errors that's going to pop up that's fine uh but when I press play and I don't use the shift it doesn't Trace that's because and I get a lot of Errors that's because at the start active camera is not set to anything so this is none so the line Trace cannot work uh that's why we get all of the errors how do we give active camera um ah camera from the start of the plane well that's that happens under event begin play right so we have already this whole chain of events that are that are happening but in between the create in between our widget and the mapping context between these I will add the set active camera so I'll just drag from this set active camera I'll add this like that and I'll set it to my third person camera or follow camera like that now if I compile save press play immediately it reads my third person camera and if I press shift it reads my first person camera and so on so we we are the line Trace works and it's hitting exactly where I'm looking at right e great that works as well and once I hit Escape no errors so this little thing solves it okay back here back to the back to the line phrase so if we hit um branch if we hit something then we need to one second I'm I'm I need to think about this one so if we hit something if it's true then it needs to check of course what it hit break hit result it needs to check what was hidden so we we get the hit actor and we will ask did does the actor that was hit um does it re implement the same interface that we're using here the interact interface well I know it's a little bit of a mouthful but that's how it works so I will ask the question thus Implement interface and which interface well we only have one so that's going to be easy interact not interact in the erect BP this one interact BP I'll minimize this because it's a little bit too too much so this will return a value of yes or no so if if it hits an object and that object that's being hidden um says that I am using the interact interface you can interact with me basically then something needs to happen let's create another branch like a logic so if all of this is true then it needs to be added to viewport right but what if it's already added to viewport it shouldn't be we shouldn't keep adding it to the viewport right every time because it we're just going to keep overlaying the same image over and over again so I need to ask is the interact dot widget also like one more statement I promise this is the last one a get interact.widget is it already in the viewport is in viewport and if we're hitting something and the thing that we're hitting is an interactable object and the viewport okay we need another branch and the viewport is indeed already shown to you like the sorry not the viewport but the little e icon is already shown to you uh then do nothing you don't need to add another one but if it's not then you need to add to viewport uh uh how is that uh viewport add okay fine uh interact.widget that's the the widget get and I'll just draw from it uh add to viewport there we go add to report so if it's false if it's not being drawn right now it's going to be drawn once and then nothing else is going to happen Okay so we have that logic of putting it on the viewport and making sure that it doesn't keep being drawn at every frame then for if it's false here it should be removed right um where else should it should it be removed it should also be removed here I believe if we're not hitting anything it should be removed from the viewport because we're not looking at anything and also oops and also if we are not if we're looking at something that you cannot possibly interact with that also needs to be removed from the viewport yeah okay so I'll just drag from here I'll create another branch bam like that so both of these statements need to go in So This falls and this Falls both of them go into this because if either one of these trigger then it's going to remove um then if it's already in the viewport I mean sorry if it's not in the viewport we're checking if it's not in the if it's not in the viewport then there's nothing to remove this doesn't matter this will not trigger anything but if it's true then it needs to be removed from viewport I need to remember I think it's like remove from parent or we can drag from here remove from parent there we go and connect through to here seems right this logic seems right okay let's compile play and just check yeah okay uh Let's Escape and go in here and make sure that draw debug type that is set to none because damn that was a lot of lines compile save play yeah there we go so as I'm looking around nothing happens and then bam e nothing e nothing e and then as I'm looking away from it e disappears right same thing with this camera e okay that's great so now if I press if I press e yeah that works perfect we have ourselves a logic a little bit of a logic here I'll just comment this and call it um show e like that so now compile save now let's uh finish this off by making one of the objects that I have here and in my viewport interact interactable so I'll I'll maybe either a desk or a window let's do a window why not let's do a window so I'm gonna close the door blueprint here and I'm actually going to go into my Blueprints and for testing door I'll right click and I will duplicate my testing blueprint and I'll call it a knack again or or just yeah knock again window BP like that neck again window blueprint double click that drag it over here like so the piece and here I'm just going to delete the cube I don't need a cube I I will need the pivot point but that's that's layer I'll make sure that my default scene root is selected as an active object and then slowly uh I'll make this smaller by the way just drag drag over from it I'll go back to my viewport and slowly add the elements that I want to be part of my blueprint right like geometries so as I select something in in my blueprint here I can see it being selected or in the outliner which is very nice so I'll just right click click select browse browse to asset like that and just drag and drop it in to my uh little component tab here like this right let's look at it in the viewport here so that's easier to to do and I understand what's what's going on and my viewport speed is very fast so two so okay here's my rubber for the window I'll also add the frame which is B rep it's just B rep so I'll just add that easy peasy bam uh the handles those need to come in uh uh wait that's fine the handles handles handles that's B rep 7 and 8. um a little bit inconvenient because they're right there but should be fine and drop them in um is there anything else that I need to fix not really I mean the oh yeah the glass the glass the glass the glass the glass is which one is it uh let's switch from lit to unlit try to select am I selecting the glass oh I am I'm already selecting the glass so that is gonna be B rep or great beer app for bam so I have myself you can see here that the problem that we were having those are the handles and everything is kind of just pushed into onto the center point that is because all of our location data is lost when we are doing this so replacing um an object is not as easy as it might seem but it's not so hard so the way you do it is you just need to find okay so B rep 3 what's the location of B rep 3 um here I will just find where B rep 3 is so that I have it selected and here I have its coordinates right in my viewport while here in my blueprint the coordinates at are at zero zero zero so all I need to do is just copy paste copy paste copy paste so that's exactly what I'm going to be doing with every single object here it's a little bit boring but you only need to do it once and once you have set it up once then your Dynamic object is done right you can just make copies of it and it's you won't need to redo this and it's literally like a what 30 seconds to do so so it's not that bad okay that's done B rep 8. that's done typically you don't need to rotate anything uh since if you're using data Smith because all of the rotations are usually mirror poor um there it is because all of the rotations are already zeroed out by data Smith but since this is data Smith we do need to use the coordinates like so uh which is uh done at this point we have them here and you can see the our little handles here they still don't have a material attached to them that's fine we will fix it um and then then there's the pivot point right the Pivot Point around which it should rotate so this is why I always suggest having a point in your data Smith file or before exporting your file as a data Smith file creating a point here if you can't do if you didn't do it that's fine because we can go back into rhino in my case and we can create a point and read the coordinates from that point the the coordinates should match even if you're you know you're in millimeters and Rhino and you're in centimeters and um unreal I'm gonna show that really quickly so here let's zoom in that's the point that I have used to export right but you can easily create a point by yourself again let's Center it there we go select that point type in what and you get the coordinates keep in mind the only coordinate that you will and this is in millimeter so it needs to be um the way I like to do it is Notepad and just move the dot by one move the dot by one and move the dot by one like that the only thing that you will notice now let me go back to unreal uh and with this point selected and with the coordinates added from or not added but these coordinates from rhino just checking the coordinates here against here you will notice that the only difference between Rhino and unreal now are that the y-coordinate needs to be inverted so you if you're reading the coordinates from Rhino you will need to to flip the y coordinate besides that it's the same numbers right so you take those numbers and you slap them onto your pivot point easy easy peasy that's it you compile you save you have your neck again window blueprint without materials yet but that is fine I'll just dock it here for a second everything is the in the correct position and it should work by the way because the event graph well we should rename them probably let's let's rename a door open I will just rename it to window open door timeline I'll rename it to window timeline and that's it that's it just these two save back in here let's actually add the blueprint where is it bam like so that's our blueprint I'll just have it outside for a second maybe here press play here's my window e to interact uh uh oh no um okay this this is not my day I guess it's not my name I guess you're screaming at the monitor right now but uh yes I did forget to actually take all of my B reps and parent them to the pivot point right so even though the pivot point was rotating since these elements that I had in the window were not parented to it nothing happened right it didn't rotate anything so we holding the shift key you select all of these and you just drag them onto your pivot point like that now if I compile save play Fifth and hit e voila opens up and closes some reason slowly um bam okay so so that works that works great we don't really need to do anything more with this we except for some reason the interaction is a little bit slow but it might be because I'm recording I will double check and just see if I didn't miss anything yes I did miss a thing so in our window blueprint under event graph the timeline when you double click on the timeline here even though we're using 1.5 seconds of Animation the length of our track is actually five seconds no no no no that means that once it finishes it keeps on going for another 5 Seconds no we don't want that we want it to be 1.5 seconds here as well so that they match up so yeah that's a small little thing that I missed compile save play e e yep open close fully Interactive nice so now back in here I will just add the proper proper materials to this so this needs to be glass you add it here you select the object you add the glass glass instance then if I remember correctly this is gonna be metal metal light that and that both of these are actually let's do it one by one also metal light metal light this is gonna be rubber Rubber and I think that's all of them right seems like it's all of them okay compile save now back here the window is nicer keep in mind that the line Trace sometimes does a lot like the glass seems like in this case it works just fine but sometimes it goes right through the glass doesn't seem to be a problem right now how do you place it in the correct area right instead of this window so first of all I will need to delete yes delete the objects here that I'm replacing like that and then back here um we already have encoded the placement of this object when we were adding the XYZ coordinates so all we need to do is for location we set it to zero zero zero so if you zero out all of the location values now it is placed in the correct space this is like a nice little bonus let's press play shift look at look at here open it close it beautiful right that works the intersection between the come on oh no now it stops yeah you can see that like the collisions and so on also work yeah as I said like the if you press it hard enough it's it's uh the collisions stop working naturally but they do work mostly um you can see here that the transparency is messing messing us up and that is because behind this glass element that we have there's another one there's another window right here so that double uh Ray Trace glass is not um let's see not that beneficial for us in this case but as long as you just hit the frame it's gonna work just fine right now we have it that is that I'm we're done we're done with the tutorial I'm going to spend some time um making the desk interactive making the um door the door interactive and um yeah that's about it one one thing to to note is if you want this file or all of the files that I create uh consider becoming a patreon supporter uh you get everything literally everything from me that I show on the channel and yeah next next step is going to be playing with the character that that should be that should be fun okay I'll see you then bye
Info
Channel: Gediminas Kirdeikis
Views: 9,526
Rating: undefined out of 5
Keywords: architeture, design, arch, architec, proces, how, clients, rhino, family, house, lithuania, company, verygoodarchitecturecompany, very, good, architecture, vray, d5render, render, real time, free, for free, alternative, rtx, gpu, bim, revit, archicad, section, dynamic, drawing, visualarq, visualark, visual, arq, v ray, v-ray, v-ray66, skechup, material, rhinoinsiderevit, rhinoinside, rhino.inside, .insiderevit, zaha, hadid, beam, engineering, block, ibeam, grasshopper, gh, adaptive, shecule, schedule, cinematic, d5, d5 render, ue5, unreal, engine
Id: 6muVvwXXfa4
Channel Id: undefined
Length: 76min 31sec (4591 seconds)
Published: Fri Mar 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.