Answers for "Get the position behind an object (locally) ?"
http://answers.unity.com/questions/722047/get-the-position-behind-an-object-locally-.html
The latest answers for the question "Get the position behind an object (locally) ?"Answer by rutter
http://answers.unity.com/answers/722051/view.html
Every GameObject has a [Transform component](http://docs.unity3d.com/ScriptReference/Transform.html), which can give you its local right, up, and forward vectors. In particular, multiplying [local forward](http://docs.unity3d.com/ScriptReference/Transform-forward.html) by `-1` will give you a "backwards" direction.
The following would give you a point one unit behind your target:
function GetBehindPosition(target : Transform) {
return target.position - target.forward;
}
Because the forward/right/up vectors are normalized (have a length equal to one), you can multiply them by any number `X` to get a point `X` units in that direction:
function GetBehindPosition(target : Transform, distanceBehind : float) {
return target.position - (target.forward * distanceBehind);
}
You can even mix and match your offsets:
function GetBehindPosition(target : Transform, distanceBehind : float, distanceAbove : float) {
return target.position - (target.forward * distanceBehind) + (target.up * distanceAbove);
}Thu, 05 Jun 2014 17:48:05 GMTrutter