Finding nearest multiple of 90
I'm trying to attach together two actor, I want to get the nearest multiple of 90 degrees in the Z direction relative to the parent actor and then update the child actors rotation with the new number. My approach for this was to just find the nearest 90 degrees (which would be in the world) then add the parent objects rotation, which I thought would give me the result I was looking for. My problem is I can't seem to find the nearest 90 degrees consistently, is there a way to find this simply? This code id what I've been trying so far, it doesn't seem quite right. When I print the number it spits out it isn't even a multiple of 90. I figured this wouldn't be that hard to do? Thanks
(comments are locked)

Follow this question
Once you sign in you will be able to subscribe for any updates here
Can you please elaborate on a question a bit? In practical terms, what are you trying to achieve? "nearest multiple of 90 degrees in the Z direction relative to the parent actor" is a bit confusing
Ya, the child actor can only be placed in four positions, each rotated 90 degrees differently on the Z axis, So i want to find this but it has to but relative to the parent, so if the parent has a Z rotation of 10 then the child needs to snap to 10, 100, 190, 280. I think I may have solved it
So basically you have 4 numbers (Parent rotation(PR), PR+90, PR+180, PR+270) and you wan to select the one thats closest to your child's rotation? Whats the logic of selecting them or do you always want PR+90? Can you please give this more sense by providing a gameplay example.