iEnemy
|
  |
| Joined: 10 Sep 2012 |
| Total Posts: 35 |
|
|
| 23 Nov 2012 10:18 PM |
| what are they used for and what do they do? |
|
|
| Report Abuse |
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 23 Nov 2012 10:23 PM |
okay so...
toObjectSpace basically returns the position "relative to" the given cframes:
example:
CFrame.new(Vector3.new(25, 25, 25)):toObjectSpace(CFrame.new(Vector3.new(26, 25, 25))
will return
1, 0, 0, rotation matrix
since the part X is 1 stud away, it returns 1.
there, simplest terms.
|
|
|
| Report Abuse |
|
iEnemy
|
  |
| Joined: 10 Sep 2012 |
| Total Posts: 35 |
|
| |
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 23 Nov 2012 11:02 PM |
toWorldSpace takes an object's coordinates and transforms them to be on a new origin in the world. Basically, toWorldSpace will add the first calling self argument with the second given one - just like how a part's position is normally found. It is added against he origin 0,0,0.
> print( CFrame.new(-10,1,0):toWorldSpace(CFrame.new(5,2,1))) -5, 3, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1 -- Notice the first three numbers
Object space is simply the distance away from another origin.
> print( CFrame.new(1,0,0):toObjectSpace(CFrame.new(5,3,8))) 4, 3, 8, 1, 0, 0, 0, 1, 0, 0, 0, 1
It's acting as if 5,3,8 is actually 0,0,0. You can do this with multiple parts in order to get the object space of all of them compared to one main part. This is how model-rotating functions are created. Then, you can change them back to the world space. |
|
|
| Report Abuse |
|