Forum

Rotate boxes towards a position vector

I am struggling with making multiple boxes face towards a point in Stride and already tried using AlignBetween - which basically works, but the boxes are also making a twist around the direction they are facing to. Tried UnitY and UnitZ for the input direction pin, but I am having the problem with both… the boxes are somehow rotating around themselves. Could anybody explain this behaviour to me and also how to solve it?

Using UnitZ:

And with UnitY:

RotateBoxTowardsPoint.vl (32.7 KB)

The trick here is to rotate in the XZ-plane first and then apply the final bit towards the target, that way you do the second rotation in a rotated coordinate space, which makes the alignment nicer:

image

RotateZToTarget.vl (30.8 KB)

2 Likes

Awesome, thank you!