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: Axis relative to a parts rotation? Local cords, not global.

Previous Thread :: Next Thread 
opplo is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 May 2015 02:21 PM
Use the Part.CFrame:inverse() * Target.CFrame
Report Abuse
opplo is not online. 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 is not online. 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 is not online. 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 is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
11 May 2015 02:38 PM
Thanks.
Report Abuse
MrNicNac is not online. 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 is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 May 2015 03:14 PM
I don't Wiki
Report Abuse
cntkillme is not online. 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
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