[Solved]SceneNode Parenting and GetSceneNodeFromRayBB

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Zeroth
Posts: 17
Joined: Wed Jul 02, 2008 11:21 pm

[Solved]SceneNode Parenting and GetSceneNodeFromRayBB

Post by Zeroth »

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. :D

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.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

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.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Zeroth
Posts: 17
Joined: Wed Jul 02, 2008 11:21 pm

Post by Zeroth »

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.
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.

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.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

I was an honour and a privilege to look into this for someone so busy and important.

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.
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.

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;;
       }
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:

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);
Alternatively, we could correct a value of 1.f to (e.g.) 0.f and hope for the best.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Zeroth
Posts: 17
Joined: Wed Jul 02, 2008 11:21 pm

Post by Zeroth »

rogerborg wrote:I was an honour and a privilege to look into this for someone so busy and important.
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?

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.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

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.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

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 :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Zeroth wrote:
rogerborg wrote:I was an honour and a privilege to look into this for someone so busy and important.
I'll bet it was, not that I ever used the word "important" or implied that I am indeed an important person.
I can just tell. Please, no false modesty.

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
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:Perhaps it would have been sensible and mature of you to keep your snide remarks to the person who appreciates them, ie yourself?
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?

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
Zeroth
Posts: 17
Joined: Wed Jul 02, 2008 11:21 pm

Post by Zeroth »

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
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:Oh, but he's far from being alone...
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=29474
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.
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!
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.
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.
"Chick"? What are these mythical creatures that you speak of? And why would I want to "pull" one of them?

I don't brush the cheetos from my manbeard for _anyone_.
rogerborg wrote:Ah, I do jest. You'll do fine here.
You have my perpetual gratitude for such a blessing. Let's hope so, otherwise I might "lose" amongst your supporters, God forbid.

It's been a pleasure, boys. We should do this again the next time I swing by the Bug reports forum.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

That was a nice crop of the end of my sentence :) Of course, what you will lose was a few words later, aka, respect ^^
Zeroth
Posts: 17
Joined: Wed Jul 02, 2008 11:21 pm

Post by Zeroth »

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 ^^
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.

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.
Post Reply