I am wanting to build objects (meshes) in game like a tent, walls, or any other mesh. My goal is to make a Survival FPS similar to Rust, 7DTD, or H1Z1, though in a much different setting/ goal.
I would like to be able to select the item from the menu (With UMG I suppose) and then have it appear, snapped to a grid, and then be able to build it.
Also, to help cater to your process, blueprint or C++?
What do you mean by building? Spawning? Or literally “building”, one piece at a time?
The button part is easy. Just make one and have it spawn whatever you want… You can then attach said object to your mouse, and when you click or hit a keybind, place it in that spot permanently.
I guess I mean spawn and using blueprint. I can spawn an actor in a given location but I am trying to parent it to pawn and snap it to a 100cm grid so as the player turns it follows in front and snaps to the grid positions.
If I press “U” then I want the mesh/actor to appear in front of the player and move with the player as described before and then when I have a good place to spawn the mesh/actor I can press “Enter” and it spawns it in a static position wherever I choose. Does this help?
Well, for the “U” action, I would use a spawn actor of a bursh/mesh with a faded material. Then for the “Enter” action, you get the current location/position of the faded actor from before and spawn it at that location(checking with the serverside of course).
Your main thing is just getting the specific locations to place them.
I think I understand. I actually started working on a system like this yesterday
Is this what you want, except for the grid action?
Alright, that’s easy then.
- Have your key input spawn the object.
- After spawning, continuously set it’s location to wherever you are looking.
- When you want to spawn, either stop updating the objects location, or like in my case, remove the “hologram” and spawn the real object in its place. (Although I will be changing it to dynamic materials later instead of having two separate objects)
(I’d show you my BPs but I’m still experimenting and they’re a complete mess)
Yes exactly like what you are doing. I suppose I don’t have to do a grid snap because it wont be voxel based.
I can get it to spawn but unable to get the location to update. I guess I am not real sure where to loop the position. As soon as I spawn it, it stays in the same spot. For now all I care is trying to spawn and move it around then I will mess with spawning the real object in place. I am using a crate as the object and I made a BP with just the crate and I spawn that class in my MyCharacter BP. The other problem is with my rotation set up it rotates the object when it spawns instead of keeping the pitch/yaw/roll set to 0.
I quickly made this to show how to move an object around. My actual BP is much more than this, but you can add whatever functionality you’d like
Not working with my current blueprint… I will try re-writing it all
Here is the most current BP, about 4 hours in the making. I am able to keep the objects rotation at 0 now which is what I want but still cannot get it to follow the player. I am making the attempt to loop “Set Actor Location” until the “Y” key is pressed and then it should “Set Actor Location” at the current location… and it didn’t work :
You should keep your spawning and location updating separate.
u → spawns object → sets boolean → event tick/loop is allowed to run → updates position
Ok, I have the moving and placing working. I need to set up a menu in UMG now too change which item the player wants to spawn. I will work on getting the hologram to work now. I considered this answered. Thanks for the help!