set actor location not working for static mesh

Hello. I’m new to unreal, and i’m trying to build an hexagonal shaped cage that has to be rebuild each level with a defined radius on beginPlay event. For this i make a static mesh component (a cube) with a width (the variable radius) and an index, to determine the coordinates and rotation angle of each wall. I put 6 of this components with diferent indexes in the scene and i rotate them in startup with the attached blueprint.

My problem is that the “set Actor Location and Rotation” works for the rotations but has no effect in the new location input.

I set the “new loc” variable to store the new location coordinates and checked that the calculated coords are correct. Also, i set the static meshes as moveable.

What i am doing wrong? please help.


1 Like

I think your maths is a bit squiffy, the location changes depending on the width… ( in a strange way ).

Thinking…

1 Like

It’s much easier to do inside on BP

I haven’t calculated the cube scale based on distance yet…

hex

1 Like

And boom

hex2

1 Like

Yes, i was just thinkering with the maths and the hex vertices when i found the problem :stuck_out_tongue:

This seems a much clever way to solve it, thanks…

I’m trying to replicate but my ‘add static mesh componet’ seems a bit different, it has not ‘static mesh cube’ written in the header…

I attach an image of how i setup the component:

Click the node, and in the details, set the cube, notice the close up here

image

1 Like

Nice, thank you!

I was looking for the hexagon inscribed in a circle, not circumscribed, with the side equal to the radius, and for this, also have to translate and rotate the sides (that’s why my math seemed strange), but with your solution I can finish solving it.

Thanks again!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.