Download

1st person building system - Snap to grid?

Hi guys, I know this is posted many times in here, but I still dont get it.
This is my building highlight:

If I move, that thing (and later the block which can be spawned) should move with my character, but not fluently just in a grid if you now what I mean. So I move, that thing comes only with with me when I go into the next grid (like in minecraft!).
Thanks for help!

Check out Rama’s victory plugin, there is a Grid Snap function which should help (click the image at my sig for the relevant post :p)

Thanks! Thats great, but how should I do that that the building highlight is always on the ground?

Do a trace and manually set the Z to the hit location Z perhaps. But it depends…

Depends on what? Could you please show my what you mean? I cant make it!

It depends on how you are using the grid snap, how you want it to behave (do you only want x,y snap?) etc. I can’t be more specific unless I know more about your setup :stuck_out_tongue:

I think the docs do a pretty good job to explain traces.
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/index.html

This is one of the ways you can get the height (Z) of the floor.

My Setup is like in Minecraft, I want to have the building block highlight always in front of me, so if I turn around, that block highlight is always in front of me, so It could be attached to some point in front of me, and its on the ground, and If I jump, the building highlight goes up to but it keeps in the grid. The building highlight is fairly simple: Its a cube with no top, 200x200x200 big. I already know about traces, but it haven’t worked. I can put my project in here later!

Heres the project: https://drive.google.com/file/d/0B_kkwi64gdF7cDZSR192VnNqX2c/view?usp=sharing

The best and easiest way is to adjust any location to a grid is to divide the x,y and z by your desired grid size then floor (or round) the result and then multiply by the grid size. :slight_smile:

Thank you Pattym. That worked perfectly for me.