Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Feature : supporting Parent to Bone (in blender) as AttachmentNode (in jme) #8

Open
Ali-RS opened this issue Aug 1, 2016 · 10 comments

Comments

@Ali-RS
Copy link
Contributor

Ali-RS commented Aug 1, 2016

Hi
In blender we can set an specific bone to be the parent of one or many objects (Ctr+P --> parent to bone) which is the same as setting an object to a bone AttachmentNode in jme.
So is it good idea to support this and make the life a bit easy ?

@Ali-RS Ali-RS changed the title Missing Feature : Parent to Bone in blender to AttachmentNode in jme Missing Feature : supporting Parent to Bone (in blender) as AttachmentNode (in jme) Aug 1, 2016
@davidB
Copy link
Member

davidB commented Aug 1, 2016

Before response, I need to understand it (usage, use case,...). I never use it.
Today in blender, iirc, I already use parent to bone to link skeleton to model.

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 1, 2016

Use Case : for example connect sword to hand of warrior so that sword will swing by his hand movement.

I tried it but it did not connect. Let me try it one more time.

@davidB
Copy link
Member

davidB commented Aug 1, 2016

So attachment is for runtime, not for design/modeling time ?

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 1, 2016

Yes , attaching is for runtime but before then I need to add some place holder Node (By place-holder i mean a node with a local translation inside bone attachment node) in design time so that for example all knifes (which are small) should have a place-holder node for of type knife, an other place holder node for type sword (which are big) which any weapon of type sword will be attached to it and so on ...
this will help manage local translation of attachments inside bone attachment node.
Could i explain the idea ?

Edit : I can do it in code with some default translation but i like to concentrate all of these works on blender and try not to hard-code them. And by simply transforming that place-holder node in blender i can change where the attachments will be added.

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 2, 2016

Tested it once more :
I am attaching the cube to arm bone of model using [Ctr+P --> Bone] in blender
attachtoparentnode
As you see in the picture in jme side it is just attached to node "Armature" (root node of model) as child which is wrong and it should be added to bone attachment node.

it supposed to be like this. I am attaching box to bone attachment node in SDK.
attachtobonenode

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 2, 2016

Parent type should be considered when exporting object relation :
untitled

@davidB
Copy link
Member

davidB commented Aug 2, 2016

Thanks for all the info (again). I agree providing support for attachment
should be added (I but I don't know when and how, I'll also check how
assimp manage it).

On Tue, Aug 2, 2016 at 9:10 AM, Ali-RS notifications@github.com wrote:

Parent type should be considered when exporting object relation :
[image: untitled]
https://cloud.githubusercontent.com/assets/5787647/17319861/d4366c52-58a5-11e6-8033-bf8fc97a427e.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAApswfkqe0wWtBdjq5GUEN_Sd601km4ks5qbu1ngaJpZM4JZlQk
.

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 2, 2016

thanks

was looking to codes.
May be there is need to add new linker for this. kind of a NodeToBone linker or use the existing NodeToNode linker (attachment node itself is an instance of Node class in jme).

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 2, 2016

I can add a test case for this in xbuf_unittest.blend file, if you want.
Anyway, you can count on me for any testing and providing information of how things work in blender side and jme side.

@Ali-RS
Copy link
Contributor Author

Ali-RS commented Aug 2, 2016

here is how to set rotation,transform of attachments in jme side to get the result same as it looks in blender:
Parent to bone in blender :
boneparrent-blender

and Parent to bone in jme using attachment nodes: (the scene and cube loaded directly from blender)
attachmentnode

for getting the same result in jme, i need to :

            Vector3f world=cube.getWorldTranslation();
            Vector3f local=new Vector3f();
            attachmentNode.worldToLocal(world, local);
            attachmentNode.attachChild(cube);
            cube.setLocalTranslation(local);
            Quaternion q=attachmentNode.getLocalRotation(); 
            q.inverseLocal();  
            cube.setLocalRotation(q);

hope it helps

So for loading in JME side we will have no problem 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants