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: toObjectSpace and toWorldSpace

Previous Thread :: Next Thread 
iSymon is not online. iSymon
Joined: 19 Nov 2011
Total Posts: 1023
21 Jan 2017 04:29 PM
so toObjectSpace returns the difference of two CFrames. i.e: print(CFrame.new(-5, 5, -1):toObjectSpace(CFrame.new(-10, -5, -1))) > -5, -10, 0, 1, 0, ##### ## ## ##### # I'm still a bit confused though, can someone kinda defined object and world for me? (I'm a noob) #code local life = nil print(life)
Report Abuse
iSymon is not online. iSymon
Joined: 19 Nov 2011
Total Posts: 1023
21 Jan 2017 04:31 PM
Wow, censored numbers? so toObjectSpace returns the difference of two CFrames. i.e: print(CFrame.new(-5, 5, -1):toObjectSpace(CFrame.new(-10, -5, -1)).p) > -5, -10, 0 I'm still a bit confused, can someone define object and world for me? (I'm a noob) ^ Fixed the #### ##### local life = nil print(life)
Report Abuse
iSymon is not online. iSymon
Joined: 19 Nov 2011
Total Posts: 1023
21 Jan 2017 04:32 PM
omg...last time

print(CFrame.new(-5, 5, -1):toObjectSpace(CFrame.new(-10, -5, -1)).p)

> -5, -10, 0


#code local life = nil print(life)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Jan 2017 04:53 PM
"object space" just means coordinates relative to the given CFrame. So if you say "I am 5 miles north of my house", that would be "object space", and if you use toWorldSpace, it would become "I am at x degrees longitude, y degrees latitude." (World coordinates)

They aren't distinctly different in Roblox, they're both CFrames, but using ToObjectSpace takes one CFrame and pretty much subtracts the other to get the relative offset (Or difference between them, or distance or whatever you call it).
ToWorldSpace is the opposite, it will take two CFrames, and pretty much adds them. (I won't go into details about what it does for rotation because though it doesn't add rotation, it's essentially the same outcome - it rotates it relative to the other one)


Report Abuse
iSymon is not online. iSymon
Joined: 19 Nov 2011
Total Posts: 1023
21 Jan 2017 05:03 PM
@JarodOfOrbiter, thanks. The way you elaborated it answered all my questions.


#code local life = nil print(life)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Jan 2017 05:04 PM
No problem, glad to help.


Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Jan 2017 05:14 PM
toWorldSpace is CFrame.new(cframe.p+cf.p)*(cframe-cframe.p)*(cf-cf.p) (cframe:toWorldSpace(cf))

toObjectWorld is CFrame.new(cframe.p-cf.p)*(cframe-cframe.p)*(cf-cf.p) (cframe:toObjectSpace(cf))


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