Home > Net >  Is there a way to know Vector3 in unity?
Is there a way to know Vector3 in unity?

Time:08-26

int resolution = 4;
Vector3 localUp = new Vector3(0, -1, 0);
Vector3 axisA = new Vector3(localUp.y, localUp.z, localUp.x);
Vector3 axisB = Vector3.Cross(localUp, axisA);

int x = 1;
int y = 1;
Vector2 percent = new Vector2(x, y) / (resolution - 1);
Vector3 pointOnUnitCube = localUp   (percent.x - .5f) * 2 * axisA   (percent.y - .5f) * 2 * axisB;

I want to know the Object pointOnUnitCube and its properties but I dont know how to.

what does pointOnUnitCube refers to does it refer to:

new Vector3(localUp   (percent.x - .5f) * 2 * axisA   (percent.y - .5f) * 2 * axisB, localUp   (percent.x - .5f) * 2 * axisA   (percent.y - .5f) * 2 * axisB, localUp   (percent.x - .5f) * 2 * axisA   (percent.y - .5f) * 2 * axisB);

or this:

new Vector3(localUp   (percent.x - .5f) * 2 * axisA   (percent.y - .5f) * 2 * axisB, 0, 0);

which one and please help me and THANKS.

CodePudding user response:

If I understand your question correctly it is a rather very generic question.

If you have two Vector3s A and B

var A = localUp;
var B = (percent.x - .5f) * 2 * axisA;

then A B results in a new vector with

new Vector3(A.x   B.x, A.y   B.y, A.z   B.z)

So in your case where you basically have A B C it will be equal to

var A = localUp;
var B = (percent.x - 0.5f) * 2 * axisA;
var C = (percent.y - 0.5f) * 2 * axisB;
var pointOnUnitCube  = new Vector3(A.x   B.x   C.x, A.y   B.y   C.y, A.z   B.z   C.z);
  • Related