Download

Building items in level as player

Hello,

I am trying to figure out how to add a feature where the player can, for example, board up windows and doors or place defensive items.

I had found a YouTube video referencing this a while back but I can’t seem to find it anymore.

Does any know of any documentation, videos or other tutorials on how to do this?

Thank you.

Create the meshes so they fit together nicely. e.g, make a wall with window opening, and also some boards that fit over the window.

Then you can easily trace to whatever you’re facing… and if it happens to be the window, then spawn the mesh in that location.

When you say “trace”, are you referring to using raycasts?

Have you considered simply having the boards over the window be a mesh component of your window actor, which you toggle the visibility of when the player boards the window up? Or do you want the boarding up to be organic to how the player places planks in the world?

The former is quite straightforward while the latter would take quite a bit more work and is a significantly more complicated problem.

Specifically a line trace by channel (which is a raycast)

That would work too. But I assumed he meant being able to build sort of like Fallout. Wouldn’t be too difficult. I set this up real quick to show what I meant in my earlier comment

https://www.youtube.com/watch?v=69onM79Hu6c&feature=youtu.be

Wow, vanlacke. That’s exactly what I’m looking for. I would just like to post a pre-fab like what you have over the windows. The windows and doors that can be boarded up will be about the same width so I wanted to use the same mesh, like what you did, that would be big enough to cover all the windows/doors.

But let’s say I wanted to add independent meshes, like a stone wall, etc. Could the same concept with the raycast be used as well? Sorry - I’m not very familiar with raycasts.

My main idea is not to create fully buildable structure (like Rust) but only where I could add items to a prefab, like gun emplacements, barricades, crates, etc.

What do you mean independent meshes? Do you mean add different types? So, instead of wooden boards, metal bars? That is totally doable, you can add as many different “building” meshed as you’d like, in any preset position. (at least with the setup I made for the vid). So for example, you could have 10 different types of door barricades, 10 window, 10 different types of “turrets”, or whatever. It just needs to be set up to have that functionality which is easy with parent/child BPs

That’s exactly what I mean. So the logic would be I could setup a trace to tell the engine what item I’m looking at then I would setup a blueprint that says “if I’m looking at a specific object(window) allow these items to render and be placed”? Is that how you did it? Thanks!

It would depend on how you want your gameplay to be. The way I have it set up is, I hit a keybind which brings up the wooden boards, then I can take the boards to the window, and if the “boards” overlap with the “window” it just snaps it into place.

Your method would be even simpler. You just look at the wall, and for example, if that wall is “buildable”, then you can press a key, or maybe a menu will appear telling you to “press f to barricade”, and you’d just place the boards.