How to spawn an actor with a precise rotation value?

Hi everyone,

I am working on a personal project in which I spawn room modules on a grid location to constuct rooms. Whenever walls get placed I wish to rotate the wall module to face in the propper direction (north, west,etc) basically rotations in 90 degree increments.

My problem lies in the floating point precision with the “make rotator” node. It generates rotation values ever so slightly of the original value (90.0008 or 89.9993) which in most cases would not pose a problem but my wall modules need to be placed precisely to avoid wall seams.

So my question is: What ways are there to spawn an actor with a precise rotation value (90.000 degrees) preferably in blueprint and without using gameticks. But I would by fine with a C++ implemented solution.

I would appreciate your help, thank you :slight_smile:

Unfortunately, that’s the deal with floats. Rarely are they precise.

Possible solution: create a mesh that’s already a room with all the walls you need. Spawn rooms, not walls.

If rooms configuration is different, possible solution No. 2: make 2 (4) different wall meshes with required transformation. Don’t rotate walls, just cycle through meshes.

Have you tried the other nodes that give you rotators?

Like FindLookAtRotation and MakeRotFromX

Maybe they’re better.

Agree. I’ve tried it myself and found that Make Rot from YZ places a new actor perpendicularly to the exiting one.

I did not try make Rot from XY, sounds good, I will give it a try. Thanks!