[Solved]SceneNode Parenting and GetSceneNodeFromRayBB
[Solved]SceneNode Parenting and GetSceneNodeFromRayBB
This thread is a continuation of where I left off in my previous thread in the Advanced Help forum where I received no replies regarding the issue at hand, so I can only assume that this is a bug.
The issue concerns the functionality of GetSceneNodeFromRayBB after parenting a scene node to another. Specifically, in my application, when I add an AnimatedMeshSceneNode as a child to an AnimatedMeshSceneNode with a skeleton or a BoneNode, I seem to now only be able to select joints within the parent Node. In actual fact, every time I try to pick a node the ray somehow manages to find Bip01_L_Toe0.
Initially I guessed that parenting caused the transformed bounding box to become the wrong size, or something similar. However, debug data shows that the transformed bounding box is correctly positioned, scaled and rotated.
The issue concerns the functionality of GetSceneNodeFromRayBB after parenting a scene node to another. Specifically, in my application, when I add an AnimatedMeshSceneNode as a child to an AnimatedMeshSceneNode with a skeleton or a BoneNode, I seem to now only be able to select joints within the parent Node. In actual fact, every time I try to pick a node the ray somehow manages to find Bip01_L_Toe0.
Initially I guessed that parenting caused the transformed bounding box to become the wrong size, or something similar. However, debug data shows that the transformed bounding box is correctly positioned, scaled and rotated.
Last edited by Zeroth on Mon Sep 15, 2008 11:15 pm, edited 1 time in total.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
If you provide a simple application and resources that replicates the bug, someone is more likely to investigate it.
Simply raising the ante by filing this as a bug is unlikely to have the desired effect.
Simply raising the ante by filing this as a bug is unlikely to have the desired effect.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Absolutely, I was merely waiting to see if anyone would take notice before I take time out of my busy schedule to create a sample application. I do not need to be informed of 'How To Ask Questions The Smart Way', thank you very much.rogerborg wrote:If you provide a simple application and resources that replicates the bug, someone is more likely to investigate it.
Simply raising the ante by filing this as a bug is unlikely to have the desired effect.
http://www.tomo.pwp.blueyonder.co.uk/BugSample.rar
Upon creating the sample application, I have discovered that the problem isn't actually caused by parenting at all. Try it yourself. If you right click any of the cubes in the scene, for the first several clicks you'll find (check the console) that the ray picks joints within the character model.
EDIT: If you comment out "scene::IBoneSceneNode* parentBone = characterNode->getJointNode("RHand");" the problem doesn't occur. It seems as if the source of the problem is the getJointNode function.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I was an honour and a privilege to look into this for someone so busy and important.
Here's the (apparent) root problem, in the source .X file:
A matrix[2] value of 1.000000 (expressed as 1.0000006f) gives a rotation of NaN in CMatrix4<T>::getRotationDegrees(). This produces a cascade of NaN bad karma that results in a NaN ray in the collision test, which collides with any box.
Root cause: bad model.
We should probably detect and log it, and bail out of the loading at that point:
Alternatively, we could correct a value of 1.f to (e.g.) 0.f and hope for the best.
That's down to it calling CAnimatedMeshSceneNode::checkJoints(). This should (IMHO) really be called automatically, since it's necessary to generate the real joint transformations. You could take this up with Luke if you're feeling feisty.Zeroth wrote:EDIT: If you comment out "scene::IBoneSceneNode* parentBone = characterNode->getJointNode("RHand");" the problem doesn't occur. It seems as if the source of the problem is the getJointNode function.
Here's the (apparent) root problem, in the source .X file:
Code: Select all
Frame Bip01_L_Toe0 {
FrameTransformMatrix {
0.000000,0.000000,1.000000,0.000000,-0.000000,1.000000,-0.000000,0.000000,-1.000000,-0.000000,0.000000,0.000000,2.075310,-0.000000,2.518657,1.000000;;
}
Root cause: bad model.
We should probably detect and log it, and bail out of the loading at that point:
Code: Select all
Index: source/Irrlicht/CXMeshFileLoader.cpp
===================================================================
--- source/Irrlicht/CXMeshFileLoader.cpp (revision 1567)
+++ source/Irrlicht/CXMeshFileLoader.cpp (working copy)
@@ -666,6 +666,12 @@
readMatrix(mat);
+ if(core::equals(mat(0, 2), 1.f))
+ {
+ os::Printer::log("A Transformation Matrix contains a value that will result in an invalid rotation", ELL_WARNING);
+ return false;
+ }
+
if (!checkForOneFollowingSemicolons())
{
os::Printer::log("No finishing semicolon in Transformation Matrix found in x file", ELL_WARNING);
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
I'll bet it was, not that I ever used the word "important" or implied that I am indeed an important person. I'm sure we can both agree that taking the time to make a sample application would have been time wasted had nobody even bothered to investigate, therefore waiting to see if it was worth doing was a logical plan of action. Perhaps it would have been sensible and mature of you to keep your snide remarks to the person who appreciates them, ie yourself?rogerborg wrote:I was an honour and a privilege to look into this for someone so busy and important.
Aside from this, you have my gratitude for investigating. I will have a poke around with the character model in 3ds Max. If you're certain that this is the source of the problem then we can consider the case closed.
Oh, but he's far from being alone...
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=29474
Also, one general tip. No matter how unfair or inappropriate you think the comments are from an elder of a community, unless you are VERY certain it was out of place or it goes against rules from said community, DON'T. ATTACK. THEM. You will lose, if nothing more than good karma in said community. And the fun part is you might not even lose it with said elder, but you will lose it amongst it's supporters.
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=29474
Also, one general tip. No matter how unfair or inappropriate you think the comments are from an elder of a community, unless you are VERY certain it was out of place or it goes against rules from said community, DON'T. ATTACK. THEM. You will lose, if nothing more than good karma in said community. And the fun part is you might not even lose it with said elder, but you will lose it amongst it's supporters.
Rogerborg is a sarcastic angry Scotsman, try not to take his blows to heart... he fixes problems, offers sound advice and makes most people laugh and some people cry. I think the crying is well worth the laughter!
On topic, I'll stick that check into the mesh loader. Thanks for the report and patch, progress has been made
On topic, I'll stick that check into the mesh loader. Thanks for the report and patch, progress has been made
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I can just tell. Please, no false modesty.Zeroth wrote:I'll bet it was, not that I ever used the word "important" or implied that I am indeed an important person.rogerborg wrote:I was an honour and a privilege to look into this for someone so busy and important.
And taking the time to shower and brush the cheetos out of your manbeard before trying to pull the lone nerd chick at your LUG is also a waste of time... if she's attracted to smelly filthy hippies.Zeroth wrote:I'm sure we can both agree that taking the time to make a sample application would have been time wasted had nobody even bothered to investigate
Tish, life is far too short to waste it being all sensible and mature. For what do we live but to make sport for our neighbours, and laugh at them in our turn?Zeroth wrote:Perhaps it would have been sensible and mature of you to keep your snide remarks to the person who appreciates them, ie yourself?
Ah, I do jest. You'll do fine here. Thanks for the report, it was an interesting investigation.
I'd suggest that if this model looks OK in 3DS, then it's down it obeying (half of it at least) Postel's Law.
We've also seen several problem X files that the MS X file viewer handles fine; it's no fun being the most pedantic kid on the block, but someone has to do it.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
There is no need for me to attack rogerborg. I'm not entirely sure of what you're referring to when you use the word "lose" though. In order for me to lose, there has to be some form of competition.Dorth wrote:Also, one general tip. No matter how unfair or inappropriate you think the comments are from an elder of a community, unless you are VERY certain it was out of place or it goes against rules from said community, DON'T. ATTACK. THEM. You will lose
Yes, and I'm sure roger's comments in this thread will make excellent entries into the book of Greatest Rogerborg Quotes of All Time. You know, because they're so clever and witty, and let's not forget funny. Oh boy, I almost had to call for an ambulance when he associated the word "busy" with "important". Genius.Dorth wrote:Oh, but he's far from being alone...
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=29474
I am grateful for the first two contributions that you listed. However, I personally could do without the ultimately vapid and lame jesting whilst the discussion could potentially decide the fate of my project.bitplane wrote:Rogerborg is a sarcastic angry Scotsman, try not to take his blows to heart... he fixes problems, offers sound advice and makes most people laugh and some people cry. I think the crying is well worth the laughter!
"Chick"? What are these mythical creatures that you speak of? And why would I want to "pull" one of them?rogerborg wrote:And taking the time to shower and brush the cheetos out of your manbeard before trying to pull the lone nerd chick at your LUG is also a waste of time... if she's attracted to smelly filthy hippies.
I don't brush the cheetos from my manbeard for _anyone_.
You have my perpetual gratitude for such a blessing. Let's hope so, otherwise I might "lose" amongst your supporters, God forbid.rogerborg wrote:Ah, I do jest. You'll do fine here.
It's been a pleasure, boys. We should do this again the next time I swing by the Bug reports forum.
Ah, now I understand what you were trying to say. Karma isn't something that you gain or lose in my mind, it's something that you cause.Dorth wrote:That was a nice crop of the end of my sentence Of course, what you will lose was a few words later, aka, respect ^^
Respect, on the other hand, is much more tangible. I can see the connection between causing bad karma within a community and losing respect amongst it, but I do think you are very much mistaken to think of them as being one and the same thing.