Spawning actor class at certain Vectors - Stuck - blueprints

I have been trying to solve this problem now for 2 days, and i have also been looking online for help and found not right much.

i am currently working with blueprints to make a little puzzle game, a little bit like infinifactory. However i have run into a wall trying to figure out how to place blocks / parts so they snap to a grid, every 100 on X, Y, Z. i have tried using Floors in combination with Line Trace’s and im just completely lost on what to do. here is a screenshot of the section of blueprint in question:

here is the Box Trace Setup


here is the Spawn actor and alignment (the problem bit)

here is the round to nearest macro part (also part of the problem)

this setup sort of works but only from certain angles. any help would be much appreciated. If you need more information just let me know.

Hello,
Have you check the puzzle project ? you have a spawning block in grid in. Maybe you need more or different. I did a basis for a mine sweeper suystem here https://forums.unrealengine.com/showthread.php?58945-Need-help-about-MineSweeper-style-algoritm&p=221467&viewfull=1#post221467 From it with events over and click you can set near blocks as you want. Example is set for 4 near squares and need adjustement for 8 squares around.

After a little bit more of playing around i changed the above Floor to a Round, and now it lets me place blocks perfectly but only on +axis (+X,+Y,+Z), i guess i need a way of doing the negative also.

Maybe “ceil” or get absolute values to set then back to original value.

just tired this and same results, can only place blocks in 3 directions

Maybe a division could do it. you divide by 100. if remainder <5, loc is return value x 100 if remainder >=5 loc is (return value +1) x100 ?

Edit : If this is not the negative values which create the issue.

i will give this a go and let you know what happens

still no go, im thinking of trying a different approach to placing the block, like snapping them to the previous actor rather than snapping to a grid

:frowning: . For grid, you may can spawn on event begin play a grid of boxes and use it as spawning location. (Same idea as what i posted before, like grid in puzzle project) but if you can use nearest actor, it is cool. I hope for you that you will not get stuck too long.

i think i know what you mean. and this would work with what i am trying to do, however figuring out how to get the correct offset from the existing actors (depending on what face is nearest and what direction etc) will be tricky

also thank you for your help so far :slight_smile: it is much appreciated

i decided to make the objects 101cm instead of 100 cm, this fixed the not working on negative axis issue.