generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

How do you access the rotational matrix of CFrame?

Previous Thread :: Next Thread 
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
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
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
10 Jan 2014 08:50 PM
No one knows what I mean?
Report Abuse
Raphael7 is not online. 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
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
10 Jan 2014 08:59 PM
How the heck do I learn to use that?
Report Abuse
FailzStrat is not online. FailzStrat
Joined: 22 Dec 2012
Total Posts: 71
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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Jan 2014 09:21 PM
backVector*
Report Abuse
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
10 Jan 2014 09:58 PM
what the heck is a back vector???
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Jan 2014 10:00 PM
The opposite of the frontVector (lookVector)
Report Abuse
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
10 Jan 2014 10:02 PM
Can someone please better explain what StBashkir said???
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
10 Jan 2014 10:06 PM
Its the x, y, and z unit vector directions of the front, right, and top.
Report Abuse
cntkillme is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image