Sign in to follow this  
gryff

An "attachToBone" oddity?

Recommended Posts

A few days back, dad72 posted a little piece of useful code for attaching an object to a specific bone. So I thought I would try it out.

 

Sword

 

It works, in the sense that I can add/ remove the "sword" (just a long thin cube) to a hand bone. BUT ...

 

Try this:

 

1. Check out the sword without clicking on it - appears like a normal elongated cube.

 

2. Click  on the sword - it attaches to the hand - but examine the sword now (without clicking on it) and the normals seem to be flipped.

 

3. Click on the sword - it detaches from the hand and returns to its original position - and the normals are back as they should be.

 

Anybody, any idea what is going on?

 

(Everything comes from Blender, I made sure that the normals are facing outside before exporting.)

 

cheers, gryff :)

 

 

Share this post


Link to post
Share on other sites
this is because the node matrix is inverted. This is not a problem for a node but for mesh it could be

 

Well to be honest DK, while I understand the general meaning of each of those words, I am still an Erasmus's "blind man" when it comes to understanding what the problem is here. :o

 

Can you control that on the Blender side?

 

 

Are you saying it is an issue with the Blender BJS exporter? An issue with Blender itself, or with the bone rig?

 

I will experiment a little more.

 

cheers, gryff :)

Share this post


Link to post
Share on other sites

First experiment was to try with the latest version of Blender (2.75a) and the latest version of the BJS exporter (3.0.5) - same result.

 

I actually had BJS exporter 3.0.0 installed in Blender 2.75a - that produced an even worse result, as clicking on the red elongated cube by the feet made it disappear completely :wacko:

 

cheers, gryff :)

Share this post


Link to post
Share on other sites
I think this is an issue with the bone rig

 

My first example used the "game rig" (32 bones) that came from MakeHuman, so I created from scratch a much simpler rig.

 

A Very Simple Rig

 

Basically a tube that bends - it has four identical bones (root, root1, head and head1 - all with the same "bone roll"). The scene has two materials, and two meshes. The animation works as it should.

 

Click on the green bar - it gets bound to the top bone ("head2") - but still the normals are flipped. Click again to detach - and normals are flipped back.

 

Et maintenant, l'epee de dad72.

 

cheers, gryff :)

 

 

 

 

Share this post


Link to post
Share on other sites

Well dad72 - here is your sword using the same simple rig I built:

 

dad72 sword

 

The sword is clickable just as the green cube I used before. Huge sword!

 

So, I positioned, scaled and rotated it. Same normal flipping as previous.

 

Mais, merci beaucoup encore.

 

Your bablylon file also gives me a chance to compare 3dMax and Blender export functionality :)

 

@DK: I will create a package of files later this afternoon.

 

cheers, gryff :)

 

 

Share this post


Link to post
Share on other sites

Ok DK here are my files for this demo:

 

Bend Tube

 

It uses the simple rig I mentioned above.

 

The zip file includes:

 

1. The Blender 2.75 . blend file - tube4.blend.

2. The export of the above with the 3.0.5 BJS exporter - tube4.babylon.

3. The exporter log file - no errors or warnings.

5 The index.html file that contains my javascript code.

 

Tube4.zip

 

Hope it helps.

 

cheers, gryff :)

Share this post


Link to post
Share on other sites

I saw that DK posted a cryptic "fixed" on the thread "Attach Mesh To Bone thread" and was not sure if the fix was for this normal flipping issue - so I tried it:

 

Bend Tube

 

This uses the latest "preview release"  BJS script.

 

Compare with the link above. Result is no normal flipping :)

 

WTG DK :) :)

 

cheers, gryff :)

Share this post


Link to post
Share on other sites

An as a further test on the new script with the original MakeHuman rig :

 

Sword 2

 

And it does not flip either, though the position that the sword ends up in is different - but that can be handled.

 

I'll say it again, well done DK :)

 

cheers, gryff :)

 

Edit: Using the new "preview release" script and

 

lol I fixed it and went to the wrong forum post

 

but fixing it was the important issue :D

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.