the situation is as follows - a path is searched, point A is looking for a path to point B, for this it calculates the initial direction, for example, point A is at the top left and point B is at the bottom right, respectively, the vector (1f, 0 -1f) is obtained. if this point is inaccessible (blocked by some obstacle), then you need to look for other directions, and of course it is better to look for the optimal ones, that is, in this situation, you need to turn 45 degrees from the current direction, then -45, then 90 and -90, etc. .d. tell me how to do this?
i tried like this
private Quaternion[] ArrayDirRot = new Quaternion[8]{
Quaternion.Euler(0f, 0f, 0f),
Quaternion.Euler(0f, 45f, 0f),
Quaternion.Euler(0f, -45f, 0f),
Quaternion.Euler(0f, 90f, 0f),
Quaternion.Euler(0f, -90f, 0f),
Quaternion.Euler(0f, 135f, 0f),
Quaternion.Euler(0f, -135f, 0f),
Quaternion.Euler(0f, 180f, 0f)
};
Vector3 dir = new Vector(1f, 0 -1f);
for(int i = 0; i < ArrayDirRot.Length; ++i){
dirRot = ArrayDirRot[i] * dir;
searchPoint = pointStart + dirRot;
but it doesn’t work, I don’t even understand how it “rotate”…