Hi, I spawn a couple of rectangular boxes on the outer perimeter of an (imaginary) circle. So all boxes are positioned at a radius of, say 100.
I got the position figured out but now I want to calculate a roll for all boxes, so their up vectors all point towards the center of the circle (the circle’s forward vector is the x-axis direction, btw.).
How do I calculate the rotation for all those boxes (using blueprints)? My vector maths are a little rusty so please excuse me if this is a simple question to solve.
That node sadly does not seem to do the trick because it just calculates any kind of rotation, i.e. it does not keep pitch and yaw at zero und only rotate around the roll axis. I need a way to only calculate the correct roll to look at the center.
Okay, I guess I just misunderstood you. I thought you were talking about the “Find Look At Rotation” node. That’s the one I tried previously and I does not have a way of restricting axis. However, I guess you meant the “Look At Function” which produces a whole transform but let’s you define exactly what kind of look at you need, like you said.
So this is how I used it in the end to achieve what I wanted to do:
If you specifically want to to use roll to point the up vector towards target, you can use this.
In that graph, “Self” is my circle actor and its location is the center.
It also assumes that the boxes are already spawned with the same rotation as the circle. If that’s not the case, call SetActorRotation(Circle->GetRotation) before adding the local roll offset.