Answers for "calculate Vector3 offset relative to surface normal"
http://answers.unity.com/questions/655659/calculate-vector3-offset-relative-to-surface-norma.html
The latest answers for the question "calculate Vector3 offset relative to surface normal"Answer by robertbu
http://answers.unity.com/answers/655714/view.html
There are a lot of different ways of solving this problem. One issue is that you have a degree of freedom here you did not define. That is the four red lines may be rotate to any arbitrary angle with the green normal as the axis. If you don't care about that rotation, then a really simple approach is to use an empty game object (with a scale of (1,1,1)). Then you can do:
empty.transform.position = hit.point;
transform.up = hit.normal;
var pos1 = empty.transform.TransformPoint(Vector3(1,0,1));
var pos2 = empty.transform.TransformPoint(Vector3(-1,0,1));
var pos3 = empty.transform.TransformPoint(Vector3(-1,0,-1));
var pos4 = empty.transform.TransformPoint(Vector3(1,0,-1));Wed, 05 Mar 2014 01:16:20 GMTrobertbu