|
| 10 Jan 2014 08:40 PM |
| Okay I understand CFrame.new(x,y,z)... but how about the other 9 in the matrix? |
|
|
| Report Abuse |
|
|
| |
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 10 Jan 2014 08:57 PM |
Well I personally don't set the whole CFrame(x, y, z, x1, y1, z1,blalalsb,,abab,abas)
I only use it when I want my cframe to be exact.
Like I set up the CFrame I want and subtract the subject by the part. [subj.CFrame-part.CFrame.p] -- You would get CFrame.new(thewhoooolenumber)
Then I set the cframe. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 08:59 PM |
| How the heck do I learn to use that? |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 09:01 PM |
@Raphael7 Nice job of making it simple for the kid.
FYI has almost nothing to do with scripts, yet near everything at the same time. |
|
|
| Report Abuse |
|
|
StBashkir
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26171 |
|
|
| 10 Jan 2014 09:15 PM |
CFrame.new(x,y,z, R1, R2, R3, R4, R5, R6, R7, R8, R9 )
Those aren't easy to understand when you first look at them. But, you know how lookVector works? That's what the rotation matrix is, basically. Except it has the rightVector, upVector, and lookVector.
R1, R4, R7 == rightVector These three numbers make up the direction the RIGHT SURFACE is looking at
R2, R5, R8 == upVector These three numbers are the direction the TOP SURFACE is looking
R3, R6, R9 == lookVector And these should be the exact same as CFrame.lookVector (or maybe they're all negative, but still the same numbers, I don't remember). FRONT SURFACE
If you just want the angles though, do:
Part.CFrame = CFrame.new(x,y,z) * CFrame.Angles(0,0,0)
And to get the angles do:
local x,y,z = Part.CFrame:toEulerAnglesXYZ();
Or, if you want all 12 numbers:
local cframe = {Part.CFrame:components()}; -- a table |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 10 Jan 2014 09:58 PM |
| what the heck is a back vector??? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jan 2014 10:00 PM |
| The opposite of the frontVector (lookVector) |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 10:02 PM |
| Can someone please better explain what StBashkir said??? |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 10:06 PM |
| Its the x, y, and z unit vector directions of the front, right, and top. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jan 2014 10:07 PM |
He explained it enough.
CFrame.new(x, y, z R1, R2, R3, R4, R5, R6, R7, R8, R9 ) x, y, z is just position Column 1 (R1, R4, R7) is the rightLookVector [x-axis], Column 2 is the upLookVector [y-axis], and Column 3 is the backLookVector [z-axis]
You can obtain this easily with the vectorToWorldSpace method of CFrame
local upLookVector = CFrame:vectorToWorldSpace(Vector3.new(0, 1, 0)) local rightLookVector = CFrame:vectorToWorldSpace(Vector3.new(1, 0, 0)) local frontLookVector = CFrame:vectorToWorldSpace(Vector3.new(0, 0, -1)) local downLookVector = upLookVector * -1 local leftLookVector = rightLookVector * -1 local backLookVector = frontLookVector * -1
Yes, for the down/left/back you can use vectorToWorldSpace |
|
|
| Report Abuse |
|
|