Procedural Mesh in wrong location

I cannot work out if this is a bug, or if I’m missing something really obvious.

I have an actor that has six Scene Components arranged in a hexagonal formation, one other Scene Component in the centre, and a Procedural Mesh Component which uses those 7 points to draw a simple hexagonal mesh.

When I place my actor at the world origin (0,0,0) this works perfectly. However, when I place my actor any distance away from the origin, the Procedural Mesh Component seems to be inheriting that transform twice. So for example, if I place the actor at (0,0,100), then the Procedural Mesh Component draws its mesh at (0,0,200). I am drawing spheres at the places where the Scene Components are, for debug purposes. This is what it looks like:

I am drawing spheres at the places where the Scene Components are, for debug purposes. It happens with rotation too. So if I rotate the actor -20 degrees, then the mesh appears -40 degrees rotated.

The strangest thing about this though, is that if I debug all the relevant transform information, it seems to be correct. I am doing this in C++, but have wired up a Blueprint function that reports the location of the actor, points, and procedural mesh. Here is an example output when the actor is at (0,0,100):

Actor World Location: 0.0, 0.0, 100.0

Procedural Mesh World Location: 0.0, 0.0, 100.0

Point 0 World Location: 0.0, 0.0, 100.0
Point 1 World Location: 0.0, 0.0, 200.0
Point 2 World Location: 0.0, 86.602539, 150.000015
Point 3 World Location: 0.0, 86.602547, 49.999977
Point 4 World Location: 0.0, -0.000036, 0.000092
Point 5 World Location: 0.0, -86.602547, 49.999977
Point 6 World Location: 0.0, -86.602539, 150.0

This data is all correct. The actor, procedural mesh component, and first point (centre of the hexagon) are all at (0,0,100). The other point positions are also correct for drawing this hexagon. The point positions are debugged from the exact place that they are used to draw the mesh section. However, it is actually drawing the procedural mesh an additional 100 units higher up.

I’ve been pulling my hair out for a whole day now trying to figure this out, it just doesn’t make sense. I can’t see why the Procedural Mesh Component is inheriting the transform of the actor it’s part of twice.

If I spawn an actor into the world which has a Procedural Mesh Component, and use that same point data to draw the mesh it’s in the correct place. Why would it wrong if it’s a component on the same actor?

Is this a bug? Or am I doing something wrong here?!

1 Like

It seems like you have set the procedural mesh’s actor relative location to (0,0,100), not the world location. Leave the mesh’s location at (0,0,0), and only move its parent around.

Have the same issue here, and this is not working. Does anybody got a clue?

Update
As peetaur mentions, it’s a matter of positioning. What I did to fix it was to spawn an actor with the procedural mesh as a root component and set the transform at 0.

1 Like