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 » Scripters
Home Search
 

Re: Very specific advanced mathematics question

Previous Thread :: Next Thread 
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
24 Jul 2015 03:43 PM
How can I retrieve and use the rotation matrix of the Coordinate Frame property of the Camera on a set of points?


It's delightful, It's delicious, It's delovely!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
24 Jul 2015 03:45 PM
This will interest you:

http://wiki.roblox.com/index.php?title=CFrame#Methods

All you need to do is: CFrame:components().

It will provide you the position and the rotation matrix.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
24 Jul 2015 04:02 PM
@thedestroyer no

local camRot = Camera.CoordinateFrame - Camera.CoordinateFrame.p

local rotatedPoint = CFrame.new(0,10,0) * camRot:inverse() -- should in theory rotate to the screen

part.CFrame = rotatedPoint
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
24 Jul 2015 04:17 PM
Maybe I misunderstood what he was asking for - sorry.
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
24 Jul 2015 04:57 PM
Guy above is almost right, but you don't invert the matrix. That's for going from object to world space. Unless I'm wrong.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
24 Jul 2015 04:58 PM
meh

i was thinking that :invert() would also invert the rotation so it would essentially be looking 'backwards' instead of 'forwards'.
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
02 Aug 2015 02:01 AM
Not a single point, a set of points, around the center 0,0,0.


It's delightful, It's delicious, It's delovely!
Report Abuse
ShungTzu is not online. ShungTzu
Joined: 14 Jun 2014
Total Posts: 959
02 Aug 2015 02:11 AM
That's hard.

Take the formula to a good math professor, and see what you can get from him.

""

x=math.rad(30)
y=math.rad(60)
z=math.rad(45)

The values of the axes are now:

x=(0.5235987755983)
y=(1.0471975511966)
z=(0.78539816339745)

For the sake of our illustration, we'll assign a name beginning with "R" to each rotation component of a CFrame with a position of (0,0,0).

ExampleCFrame=CFrame.new(0,0,0,R00,R01,R02,R10,R11,R12,R20,R21,R22)

To understand how the values of the rotation components of the CFrame are derived, we can begin by transposing them into the positions of a usable matrix.

R00 | R01 | R02

R10 | R11 | R12

R20 | R21 | R22

With the matrix above representing keys to the values in their respective positions below, with the values we have for x, y and z from our inital vector corosponding, respectively, to the x in Matrix A, the y in Matrix B,
and the z in Matrix C, the values for the rotation components will be derived according to the following formula:

Matrix A;

1 | 0 | 0

0 | cos(x) | -sin(x)

0 | sin(x) | cos(x)


is multiplied by Matrix B;

cos(y) | 0 | sin(y)

0 | 1 | 0

-sin(y) | 0 | cos(y)

and the resulting matrix is multiplied by Matrix C;

cos(z) | -sin(z) | 0

sin(z) | cos(z) | 0

0 | 0 | 1

the result of which, given the values we began with for x, y and z, happens to be

(0.35355339059327 ) | (-0.35355339059327) | (0.86602540378444 )

(0.91855865354369 ) | (0.3061862178479 ) | (0.25 )

(-0.17677669529664) | (0.88388347648318 ) | (0.43301270189222 )
.

If we transpose those cells back into their respective positions in our example CFrame, it will look like this:

ExampleCFrame=CFrame.new(0,0,0,0.35355339059327,-0.35355339059327,0.86602540378444,0.91855865354369,0.3061862178479,0.25,-0.17677669529664,0.88388347648318,0.43301270189222)
""
Report Abuse
ShungTzu is not online. ShungTzu
Joined: 14 Jun 2014
Total Posts: 959
02 Aug 2015 02:18 AM
But then, if all you want to do is get the value of each cell in the current matrix, all you have to do is

matrix=workspace.CurrentCamera.CoodinateFrame:components()
print(matrix)

and the matrix is the last 9 numbers arranged as described above.
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
02 Aug 2015 02:29 AM
I've figured this out on my own, anyway:

For each point (assumed to be a CFrame)
Camera.CoordinateFrame:toWorldSpace(Point)*CFrame.new(0,0,-10)

To stop it being moved directly to the camera:

Camera.CoordinateFrame:toWorldSpace(Point)*CFrame.new(0,0,-10)-Camera.CoordinateFrame.p

It's delightful, It's delicious, It's delovely!
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
02 Aug 2015 02:32 AM
Although if I didn't have that handy dandy method, that would probably be the technically correct way of accomplishing this.


It's delightful, It's delicious, It's delovely!
Report Abuse
ShungTzu is not online. ShungTzu
Joined: 14 Jun 2014
Total Posts: 959
02 Aug 2015 12:43 PM
It doesn't look like it would be, it looks like I didn't understand your question at all.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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