Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
In CopperLicht, is it possible to have a simple root scene node that contains a skeleton with an animation and then add child nodes to the root that move along with the root animation? The use case I have in mind is being able to customize your character's appearance, but no matter how it looks, it always controls the same and has the same animations. For example, one character might have a human head with a thin body and another might have a robot head with a fat body, all depending on what the user chooses, but ultimately they play and animate exactly the same. |
||||
|
Ah, you mean attaching a 3d object to a joint of an animated character? Currently, this is not possible, no, sorry. But it is already on the TODO list. |
||||
|
Oh ok, thanks for the quick response. Any idea of roughly when that functionality will be available? EDIT: Is it possible to swap parts of meshes at runtime? So for example, if I had an animated mesh of a character holding a crowbar, and I wanted to swap the crowbar with a baseball bat, would that be possible? Or are all the components of a mesh treated as one giant mesh once it gets loaded? |
||||
|
I've been printing the scene node to the console to try to figure out how it stores mesh data for each sub-mesh and I've been playing around with some of the values to see if I could replace sub-meshes with other meshes. I have an AnimatedMeshSceneNode, and from what I can tell the data has to be under "Mesh." The mesh I'm using is comprised of 9 sub-meshes, so I basically tried to find everything under "Mesh" that was an array of size 9. I came up with the following fields: Mesh.LocalBuffers Mesh.RootJoints[0].Children Mesh.Vertices_Moved Is there any way I could swap one mesh with another simply by overwriting the data in one or more of those arrays? If so, which ones would I change and which ones would stay the same? |
||||
|
I don't think that would work, but what you could do is to search the joint you are looking for (in AllJoints), by name (each joint has a property 'name'). After animation, joints have a property .GlobalAnimatedMatrix. You can get its rotation (getRotationDegrees()) and translation (getTranslation()) and set this as new rotation and position for your new mesh. |
||||
|
If I did manage to attach a mesh with the correct rotation and translation, will it then animate with the rest of the parent model without having to manually update it every frame? Also, when do you expect to have official support ready for attaching a 3D object to a joint of an animated character? |
|