opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 11 May 2015 02:10 PM |
I've never learnt to do this and it's pretty important.
How would i find axis relative to object cords and not world cords?
Hope I've explained this right, hard to do without a diagram. For example I believe using Ctrl+L while moving a brick makes it so you can move a brick relative to it's rotation on it's own grid.
I'm not sure if that's what vectorToObjectSpace does. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:12 PM |
| You can use the CFrame * operation to get object space differences |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 11 May 2015 02:17 PM |
| I don't understand what you mean by that. The only way I can think of doing local axis is by using CFrame() + CFrame.lookVector |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:18 PM |
CFrame * Vector3 -> CFrame Returns a CFrame offset by the Vector3 in object space |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 11 May 2015 02:19 PM |
Ah I see. Wiki.
Would this work if lets say I wanted to create an imaginary 3D grid on a brick?
For example I make the bottom left corner an origin of (0,0,0) Then I want to find the location of (5,0,7) on that brick, making sure it's relative to the rotation of the part. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:21 PM |
| Use the Part.CFrame:inverse() * Target.CFrame |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 11 May 2015 02:23 PM |
Alright thanks, I'll give it a try.
|
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 11 May 2015 02:33 PM |
That worked perfectly thanks.
Could you explain why you inversed the first CFrame? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:36 PM |
| Mathematical inverse. Local space for (3,3,3) from (1,1,1) is (2,2,2), which you can get by putting (1,1,1) to (-1,-1,-1) and adding the (3,3,3). Same for CFrames, really. |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 11 May 2015 03:07 PM |
Or you use the correct API for what it's there for:
CFrame:toWorldSpace(LocalCFrame);
or
CFrame:vectorToWorldSpace(LocalVector3) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 May 2015 05:53 PM |
Also to be more exact: CFrame * Vector3 -> Vector3 (not a CFrame) |
|
|
| Report Abuse |
|
|