find a position behind an object

I’m pretty sure this is a common camera problem.

I have a target that is facing a particular direction. How do I position the camera so that it is behind the target?

I’m working through a book example but the camera it uses is clearly not working correctly so I set about fixing it. However the book isn’t good on the 3d maths side of Unity and as such it’s all very confusing!

Pseudo code will do in fact it might be better!

Actually, is this as simple as saying target z position -10 and then converting that to world space?

You can look at the SmoothFollow script (from the standard Scripts package) for one way of doing it.

–Eric

Cheers I’ll check those out but in the meantime I managed to figure out it’s as simple as

transform.position = target.TransformPoint(0, 0, -2);

took me a while though :slight_smile:

1 Like