Orienting an object to look at target based on an up vector?

Hi there,

I’m struggling a bit with this problem and I was wondering if you could point me loosely in the right direction. I couldn’t really find anything in any UE4 tutorials or books that might help.

Using the Look at Rotation function, I am able to make a turret face a player - and by scrubbing roll, I can ensure the turret gimballs correctly based on a world up vector. So far so good.

The turret itself is composed of a base (the U shaped assembly) and the gunner assembly. The base rotates and the upper half rotates and pitches, so they always stay aligned and my model is based on this: - YouTube

Given that I’d really like to spawn this turret on a placement on an object which could have variable orientation (like a ship or large moving vehicle or even an airship or something)… I understand why this doesn’t work, because this is all world-axis information and these are not world-oriented object.

I’m really left scratching my head with this problem.

You can get the LookAtRotation, and CombineRotators with a 90 degree forward rotation. The order of the inputs for the CombineRotators will matter, try both ways to make sure you get the right one.