GuiObjectView annoying problems
by John Vanderbeck · in Torque Game Engine · 03/26/2004 (6:45 am) · 12 replies
I posted this in my .plan last night. I've seen posts of this problem before and I don't think anyone has managed to fix it so i'm bringing it back up for discussion. This is driving me nuts.
We are using a modified version of the GuiObjectView control, with all the enchancements made to it in the resources, and we are having a problem with the mounting of objects. Occosionally some of the objects just dont' mount. The code says they do, and if you step through it looks like they do mount and render, but they don't always show up. It is completely random.
I was just stepping through the rendering code a few minutes ago and it seems as though the transform matrices are getting fubared every now and then for some reason. I say seems because it was hard to nail down. I messed around in the UI until I got a car with 3 out of the 4 wheels to shopw up, I then broke into the render routine and stepped through. 3 out of the 4 mounted objects had "normal" looking transform matrices and the 4th had one that was all whacked out with exponential numbers. I though to myself "Yes! Thats it!" I then stepped back through the render routine so that I could this time around step INTO the functions where it was handling these matrices. But this time around all 4 looked right :(
I'm not a whiz with the 3d crap by any stretch of the imagination so I can't really look at the code and see anything obviously wrong.
We are using a modified version of the GuiObjectView control, with all the enchancements made to it in the resources, and we are having a problem with the mounting of objects. Occosionally some of the objects just dont' mount. The code says they do, and if you step through it looks like they do mount and render, but they don't always show up. It is completely random.
I was just stepping through the rendering code a few minutes ago and it seems as though the transform matrices are getting fubared every now and then for some reason. I say seems because it was hard to nail down. I messed around in the UI until I got a car with 3 out of the 4 wheels to shopw up, I then broke into the render routine and stepped through. 3 out of the 4 mounted objects had "normal" looking transform matrices and the 4th had one that was all whacked out with exponential numbers. I though to myself "Yes! Thats it!" I then stepped back through the render routine so that I could this time around step INTO the functions where it was handling these matrices. But this time around all 4 looked right :(
I'm not a whiz with the 3d crap by any stretch of the imagination so I can't really look at the code and see anything obviously wrong.
#2
03/26/2004 (7:23 am)
Sanity check on object transform failed. Object:tire2.dts_hub0 Node Index:6 Pos X:1734803456.000000 Pos Y:3.294611 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub1 Node Index:1 Pos X:1.534804 Pos Y:541081600.000000 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub2 Node Index:2 Pos X:1734829824.000000 Pos Y:1734829824.000000 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub3 Node Index:3 Pos X:1734829824.000000 Pos Y:1734829824.000000 Pos Z0.192688 Sanity check on object transform failed. Object:tire2.dts_hub0 Node Index:6 Pos X:1734803456.000000 Pos Y:3.294611 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub1 Node Index:1 Pos X:1.534804 Pos Y:541081600.000000 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub2 Node Index:2 Pos X:1734829824.000000 Pos Y:1734829824.000000 Pos Z1734829824.000000 Sanity check on object transform failed. Object:tire2.dts_hub3 Node Index:3 Pos X:1734829824.000000 Pos Y:1734829824.000000 Pos Z0.192688
#3
Just thinking out loud here...
The transforms don't change at all while the object is loaded and being rendered. I let it run for a while and made a cursory examination of the log, and even when they are "wrong" they don't change. So the problem doesn't seem to be the transforms, at leastnot directly. It isn't until you first load the object that "something" gets into place that causes the transforms to be off.
I just need to figure out what that "something" is and why it only happens sometimes.
03/26/2004 (7:24 am)
Interestingly the "bad transforms" are consistant.Just thinking out loud here...
The transforms don't change at all while the object is loaded and being rendered. I let it run for a while and made a cursory examination of the log, and even when they are "wrong" they don't change. So the problem doesn't seem to be the transforms, at leastnot directly. It isn't until you first load the object that "something" gets into place that causes the transforms to be off.
I just need to figure out what that "something" is and why it only happens sometimes.
#4
1734829824 => 0x67676700 => "ggg" (+null)
541081600 => 0x20404000 => space "@@" NULL
1734803456 => 0x67670000 => "gg" NULL NULL
One odd thing is that floats don't usually show patterns so cleanly.
I would look for passing pointers to string[s] instead of pointers to a matrix. Also any where in the source/scripts where ggg exists may give a clue. Maybe a problem in pack/unpack?
03/27/2004 (9:07 am)
If you print the value in hex you'll see a couple of patterns.1734829824 => 0x67676700 => "ggg" (+null)
541081600 => 0x20404000 => space "@@" NULL
1734803456 => 0x67670000 => "gg" NULL NULL
One odd thing is that floats don't usually show patterns so cleanly.
I would look for passing pointers to string[s] instead of pointers to a matrix. Also any where in the source/scripts where ggg exists may give a clue. Maybe a problem in pack/unpack?
#5
03/27/2004 (9:55 am)
Now thats darned odd.
#6
it looks like it tries to find the mountPoint node's index, it gets -1 if there isnt one, it uses that -1 to index into the nodeTransforms array
im not sure what it is getting when it works right (maybe your bounding boxes pivot by some strange luck?) either way it seems to fix the problem if you just include a mountPoint in your model
make sure you AlwaysExport "mountPoint" from your exporter (in the .cfg) and put mountPoint in all the models that mount onto another model
i havent finished adding it to all of my models but SO FAR with the ones i did add it to they have stopped coming up with wrong transforms
also make sure that your mointPoint isnt under base01 or it will exclude it even with AlwaysExport
10/12/2004 (8:34 am)
I noticed this same issueit looks like it tries to find the mountPoint node's index, it gets -1 if there isnt one, it uses that -1 to index into the nodeTransforms array
im not sure what it is getting when it works right (maybe your bounding boxes pivot by some strange luck?) either way it seems to fix the problem if you just include a mountPoint in your model
make sure you AlwaysExport "mountPoint" from your exporter (in the .cfg) and put mountPoint in all the models that mount onto another model
i havent finished adding it to all of my models but SO FAR with the ones i did add it to they have stopped coming up with wrong transforms
also make sure that your mointPoint isnt under base01 or it will exclude it even with AlwaysExport
#7
But anyway, I'll give this a try. This problem has been bothering me for the past 4 months or so... its about time it gets fixed ;)
10/15/2004 (3:04 am)
I'm experiencing this problem when mounting wheels to my vehicle in the objectview. So you are suggesting I should add a mountpoint in my wheel model? If you ask me it would be better to fix the code so if there's no mountPoint it takes the center of the model or something like that.But anyway, I'll give this a try. This problem has been bothering me for the past 4 months or so... its about time it gets fixed ;)
#8
Unfortunately, even after putting in a "mountPoint" in to my models it doesn't look like my GuiObjectView wants to mount things consistently. Maybe I'm misunderstanding the situation but I've tried adding a "mountPoint" node and a "mount0" node, one rooted to "Root" and another rooted to "Start01" and both times the model doesn't seem to attach properly in GuiObjectView.
So, if you could clarify what exactly you mean by "just include a mountPoint in your model" that would be really really helpful.
06/28/2005 (10:26 pm)
I've posted to the original guiObjectView resource a link pointing to this thread since this thread seems to be the only glimmer of hope when it comes to solving the "randomly mounting and not mounting" problem.Unfortunately, even after putting in a "mountPoint" in to my models it doesn't look like my GuiObjectView wants to mount things consistently. Maybe I'm misunderstanding the situation but I've tried adding a "mountPoint" node and a "mount0" node, one rooted to "Root" and another rooted to "Start01" and both times the model doesn't seem to attach properly in GuiObjectView.
So, if you could clarify what exactly you mean by "just include a mountPoint in your model" that would be really really helpful.
#9
06/28/2005 (11:11 pm)
Actually, there have been numerous posts on this issue, search.
#10
06/29/2005 (1:52 am)
None of the posts provided a solution tough. We have it fixed now, but its possible its a hard-coded fix. Should check with the my co-developer.
#11
I have no idea what I'm doing but I'll be sure to post something if I get something working.
06/29/2005 (11:08 am)
Yes, a lot of discussion but no defintive answer. In the mean time I've decided to try my hand at implementing a shapeBase-based gui viewer.I have no idea what I'm doing but I'll be sure to post something if I get something working.
#12
05/31/2007 (10:56 pm)
Around line 607 in the version of guiObjectView.cc that I've got is;void GuiObjectView::meshObjects::load(S32 index, const char* name, const char* shape, const char* skin, S32 pIndex, S32 pNode, S32 detail)
{
// ...
mMesh[index].node = mMesh[index].mesh->getShape()->findNode("mountPoint");That is where we try to find a defined mountPoint for the object being mounted. If your .dts file doesn't have a node called 'mountPoint' then findNode() will return -1. You are probably expecting to fallback to using the object origin as it's mount origin. So just after that call add this;if (mMesh[index].node == -1) {
// no node named 'mountPoint', fallback to using origin
mMesh[index].node = 0;
}... and you're problems will be over.
Torque Owner John Vanderbeck
While the "try to get it again" part apparently doesn't help, it at least confirms that in these cases it does have bad transforms. The debug text only show up in cases where one or more objects are not showing up. It seems for some odd reason that they are getting transformed wrong. But only every now and then, completely random.