philipp.marcks Posted November 14, 2013 Posted November 14, 2013 hi!i have a very basic skeleton with "dummy-cubes" skinned to it and animations.but i want to attach a group consisting of several parts to it. so if a joint rotates the whole group will rotate with it.but it seems the joint does not really exist in node-hierarchy - only within smesh of dummy cube.making locator and attachement is rather difficult for me though :(i then need to define character and everything!?i tried copying things from character demo - and made .character xml-file etc.but i have no clue how these things need to be connected and what additional scriptfiles are necessary.i have coders here as well, but they are not familiar with unigine and start to hate me, i'm afraid :Dit will be a basic setup for a moving object - with exchangeable parts, so i didn't want to skin the whole thing.it consists of many pieces and some need to be switchable. i would love to keep the hierarchy in the node-editor, and only "parent-constraint" groups to joints because i want to make the animations in maya.i think if i made the whole thing one smesh, i would lose flexibility regarding the exchangability of meshes.is there a more simple way to constraint things to joints than locators and attachements?maybe someone can give us some hints or help on how to set something like this up?kind regardsPhil
unclebob Posted November 18, 2013 Posted November 18, 2013 Hi Phil! Sorry for late reply. I'm assuming you want to attach other nodes to skeleton bones (like armor parts or weapons or stuff).Let's say you have ObjectMeshSkinned node and you want to attach some nodes. It's very easy to do that, just place WorldTransformBone as a child to ObjectMeshSkinned node then select the proper bone and place your attachment node as a child to WorldTransformBone node. You can see that setup in samples/worlds/bone_00 sample.
philipp.marcks Posted November 19, 2013 Author Posted November 19, 2013 Thank's a lot! - easy indeed :)
oliver.markowski Posted March 18, 2014 Posted March 18, 2014 Hello! Leading on from this, how would one set up an example like this in code rather than in editor? I've found plenty of examples using character attachments (which also suffer from one-frame latency issues), or examples set up as node files, but haven't found anything for non-characters. Is there an attachment node class (I could not find one other than the character attachments), and if so, how would one use it in Unigine script? Thanks!
unclebob Posted March 18, 2014 Posted March 18, 2014 Hi, Oliver! It's better to start a new topic. That would keep our forum clean and helpful. There are several ways to do so for skinned meshes: 1) Set transform directly using bone transform. Check code in samples/objects/skinned_02. Here is cleaned up version: ObjectMeshSkinned skinned_mesh; ObjectMesh attachment_mesh; int bone = skinned_mesh.findBone("<your bone name>"); mat4 bone_transform = skinned_mesh.getWorldBoneTransform(bone) attachment_mesh.setWorldTransform(bone_transform * <your transform here>); 2) Use WorldTransformBone node. Check samples/worlds/bone_00 code. Here is cleaned up version: ObjectMeshSkinned skinned_mesh = new ObjectMeshSkinned("<your path to smesh here>"); for(int i = 0; i < skinned_mesh.getNumBones(); i++) { ObjectMesh attachment_mesh = new ObjectMesh("<your path to mesh here>"); WorldTransformBone transform = new WorldTransformBone(skinned_mesh.getBoneName(i)); transform.setRadius(100.0f); transform.addChild(mesh); skinned_mesh.addChild(transform); } For non-character just use node hierarchy. :)
Recommended Posts