sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
When I type into output
print(game.Workspace.sayhisam1.Torso.CFrame.lookVector)
I get something like
-0.966105103, 2.82760565e-022, -0.258149564
What exactly does this number mean?
Is it representing a value?
Is it in radians, degrees, or neither?
I am so confused.. |
|
|
|
Alright well:
Look vector is the way the "Front" is facing, all parts have a front just look in the surface tab to see which side is the front.
And that would print whitch exact way, according to Vector3 your torso is looking. |
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
I don't really quite understand the concept of direction unit vector.
Could someone explain this to me?
Like, if my lookVector was (1,1,1), what would my player look like? |
|
|
You would have multiple "Front" surfaces (I think)
Since LookVector measures in scales from 0-1
But,
(LookVectorX, LookVectorY, LookVectorZ) -- Maybe Y and Z might be switched, but I think Lua put then in alpha order. |
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
I know that it measures from 0-1, but how would you be able to use this information?
What "direction" is (0,0,0) lookVector representing?
Would your block in question be facing up?
Down?
|
|
|
LookVector 0,1,0 Is facing up
LookVector 0,-1,0 Is facing down |
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
Ah, thank you, that really clears up a lot.
so 180* lookVector would get you the lookVector in degrees? Assuming that 0 is facing straight forwards, and -180 is down, and 180 is up. |
|
|
Yes, but that would scale 180 down to the 0-1 scale for you; So it would work. |
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
so then if you were to turn a part upside down, so that it would be facing behind where it was, but upside down, what would the lookVector be then? |
|
|
Just it's negative counterpart.
part = script.Parent
function reverse()
wait(1)
part.LookVector = (0, 1, 0)
wait(1)
part.LookVector = (0, -1, 0)
end
This function just reverses it's LookVector over the Y axis.
|
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
Pretty sure lookVector is read-only.
And is located in CFrame of a part...
On a side note, what is the rotation of a part, then?
Can you convert between lookVector and rotation? |
|
|
It's not read only,
you can do stuff like
Part.Position = NewPart.CFrame.LookVector * CFrame.new(2, 0, 0) |
|
|
The "lookVector" is the "forward vector" of the 3 vectors that make up the rotation part of the CFrame. (Well, actually it is the negative back vector, but yeah)
Here is how the rotation part of a CFrame works:
UpX, RightX, BackX
UpY, RightY, BackY
UpZ, RightZ, BackZ
Where Up, Right and Back are 3 perpendicular unit vectors which represent the 3 facing directions of the matrix. |
|
sayhisam1Join Date: 2009-11-25 Post Count: 2092 |
Ah, so the rotation part of the CFrame are the quaternions, right? |
|