Advertisement
CloneTrooper1019

How my objFromUserId function works.

Aug 22nd, 2014
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. rproxy.tk is a mirror site which allows you to send GetAsync requests to Roblox (bas
  2.  
  3. So
  4. http://www.rproxy.tk/User.aspx?ID=2032622
  5. is the same as
  6. http://www.roblox.com/User.aspx?ID=2032622
  7.  
  8. The GetAsync function takes a webpage url input, and returns the source of the webpage as a string. Roblox doesn't allow you to use GetAsync on their own website due to DDOS risks (apparently).
  9.  
  10. Using the HttpService, I use a certain web API provided by roblox to get the URL for some information regarding the 3D Model.
  11. http://www.rproxy.tk/avatar-thumbnail-3d/json?userId=2032622
  12.  
  13. That gives me a JSON string which tells me the URL for the object information.
  14. {"Url":"http://t0.rbxcdn.com/4261d8d28ef71ad4c55ab34eacf3732c","Final":true}
  15.  
  16. Using HttpService:JSONDecode(str), I can convert this text into a table. The "Url" becomes a key in the table, and its value is the url.
  17.  
  18. From there, I call HttpService:GetAsync() on the rbxcdn link. Because rbxcdn isn't a direct roblox domain, we are allowed to use GetAsync on it.
  19.  
  20. That will give us another JSON string.
  21.  
  22. {"camera":{"position":{"x":2.22807,"y":107.204,"z":30.7928},"direction":{"x":0.40558,"y":0.40558,"z":0.819152}},"aabb":{"min":{"x":-2.35911,"y":101.93,"z":24.5063},"max":{"x":1.8829,"y":107.66,"z":27.857}},"mtl":"8c74670330a6b89a4b8f3d82a032f645","obj":"d531c240bf1fb70860ed7ea91cda813b","textures":["7b0ca188c454b117eea009bd8782146b","d24ddb624f57cac6a9d7aabb463fe182","282a48d21df5c5c916953ba6446a05fd","870e8e9d8fc4440e7b518cfe53cf7731"]}
  23.  
  24. What we're concerned about in this, is the "obj" key, as it contains a hash for a rbxcdn link ( that link being the raw obj file )
  25. Once again, I convert this string into a table, and extract the obj hash d531c240bf1fb70860ed7ea91cda813b
  26.  
  27. Now, using another website API from roblox, we can get the URL associated with this hash by calling GetAsync on this url:
  28.  
  29. http://www.rproxy.tk/thumbnail/resolve-hash/d531c240bf1fb70860ed7ea91cda813b
  30.  
  31. That will give us the rbxcdn url to our raw obj file! :D
  32.  
  33. {"Url":"http://t5.rbxcdn.com/d531c240bf1fb70860ed7ea91cda813b"}
  34.  
  35. On the http://t5.rbxcdn.com/d531c240bf1fb70860ed7ea91cda813b page, a raw .obj file (being my character) is put on the page. Using a .obj loader script, I can draw this into the workspace with polygons.
  36.  
  37. That's basically it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement