Box trace ending up offset far away

I am currently working on procedural generation for a project. It’s meant to generate multiple static meshes (tables, plants, etc) and it worked fine. However, i do need to set a distance around each generated mesh so that the player can still navigate. My code currently generates an array of locations in a for loop, then in another for loop, does a box trace at the location, and generates a mesh there based depending on whether it detects a hit or not. My problem is that the box trace, while using the exact same location as the mesh, always ends up offset far away. I tried accounting for the offset, but it seems to be offset by a different amount each time. I have no idea why this is, please help :frowning:

1 Like

Can you show how you calculate where to place the box?


and here’s the code for generating the locations:

1 Like

Box trace takes world coordinates, add static mesh component uses relative.

I think that’s the problem :slight_smile:

You can convert it to world with

this did fix it, thank you :slight_smile:

1 Like