|
| 29 Jul 2012 08:09 AM |
I know how annoyed you guys get when someone asks a question here, but I figure you guys know the most about Roblox's file format out of anyone that goes to Scripting Helpers.
I was trying to create parts dynamically, via my own program(because laziness). I know it's easier to just do in Studio, but I'm very stubborn, and I wanted to play with their XML for a bit. =P
The part creation goes very smoothly, giving each part the exact properties I specified. The only real problem comes up when I try adjusting the CFrame. When I check in Roblox, the CFrame defaults to the identity matrix. In the file, it's as the program claims. At first, I just assumed "Oh, I bet my math is just off." So, I did a check to see if the matrix is orthogonal.
Here's exactly what I got, by multiplying the matrix with its inverse.
1.0, 0.0, 0.0 0.0, 1.0, 5.551115123125783E-17 -0.0, 0.0, 1.0
Obviously except for the number on the side, that's a _perfect_ identity matrix. Is 5...e-17 somehow too large an error for Roblox to handle? Or, is there another reason it's rejecting a perfectly good Rotation Matrix? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 08:10 AM |
I know a bit off-topic plus caps but:
I REMEMBER YOU FROM THE GOOD OLD DAYS IN THE SCRIPTERS FORUM! |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 08:20 AM |
Yeah. I figured I'd stop back here every now and again, see how people are doing and such. That is, while I still have free time. =P
/ Off Topicness |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 08:28 AM |
| I remember you too. Sorry, can't really help with this. But it would be neat to see this program when you are done with it. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 08:39 AM |
Well, I plan on releasing it if I can get it to generate CFrames correctly. I might even open source it when I get too lazy to update it. =P
On the question: I actually tried saving basic parts in rbxm files, to figure out the difference between Roblox's xml and my own. I ended up with a _really_ strange result.
I started with a basic part, and threw this in the command line. Workspace.Part.CFrame = CFrame.new(0, 10, 0) * CFrame.Angles(2.5, 0, 0)
I saved it as a model, checked the XML(it seemed okay), and tried to insert it again. I expected the block to be, at the very least, rotated in the same way. The actual result I got was the same block, but it's CFrame was rounded to the nearest 90 degree angle!
Could someone try that out for me, and make sure I'm just insane? Because, if that actually happens... I don't even know how Roblox loads models... Maybe someone(possibly a mod) could inform me as to why that would happen? |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 29 Jul 2012 10:51 AM |
"Is 5...e-17 somehow too large an error for Roblox to handle"
Roblox is _very_fault tolerant with CFrames. You'd have to completely and utterly break the CFrame to make Roblox unable to handle it.
So, it's probably something else. Are you sure you have the exact right format for the CFrame property? |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 11:14 AM |
@Stravant
Sorry. I should've posted when I resolved the problem earlier, but I figured the thread wouldn't be getting much more attention.
I found out that it was probably caused by the way my Matrix was oriented. I guess Roblox didn't like it too much. Plus, I had to make sure I used Tools > Insert Model Raw, so it doesn't round off my coordinates.
Though, I will say right now, Roblox treats models kind of strange. The working result I had was intermittent. Sometimes Roblox would insert it correctly, other times it would adjust the CFrame in strange ways. That, and I think I realized that the XML order matters in some cases.
Either way, I appreciate that you wanted to help. I'll keep this thread open, just in case I have another problem(that doesn't involve my poor math skills =P). |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 29 Jul 2012 12:09 PM |
"That, and I think I realized that the XML order matters in some cases."
Make sure you're doing your referents properly. Stuff will not load correctly if you don't have them sequential as expected. |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jul 2012 12:18 PM |
@Stravant Earlier, when I was doing some tests to see what I could optimize out of the XML, the referents didn't seem to affect anything I was looking at. So, I took them out to save space.
Do they just help order the bricks, like I suspected? Or can they actually influence the orientation of a brick? If they can, I may need to add them back in. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 29 Jul 2012 12:35 PM |
The referents are for deserialization. What happens when you save a model with an ObjectvValue pointing to part of the model? It doesn't just get nulled out, it uses the referent to specify what object it's pointing to.
Ideally it wouldn't be necessary but I would leave it in because in practice the loader may expect it to be there and do bad things when it is not.
|
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 12:42 PM |
| Okay, thanks for the tip. It seems to create a default just fine, but I'll try and work the referent back into the XML. Shouldn't be too hard to keep track of the number of instances. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 29 Jul 2012 12:45 PM |
| Yup, just have a counter and increment it every time you write one. |
|
|
| Report Abuse |
|
|