正在加载 Collada 动画关节?
我在从 collada 文件的“动画”节点加载联合数据信息时遇到问题。
首先,我尝试从“library_visual_scenes”加载关节:
前两个关节看起来像这样:
<visual_scene id="" name="">
<node name="joint1" id="joint1" sid="joint1" type="JOINT">
<translate sid="translate">0.000000 -2.000000 0.000000</translate>
<rotate sid="jointOrientZ">0 0 1 90.000000</rotate>
<rotate sid="rotateZ">0 0 1 0.000000</rotate>
<rotate sid="rotateY">0 1 0 0.000000</rotate>
<rotate sid="rotateX">1 0 0 0.000000</rotate>
<scale sid="scale">1.000000 1.000000 1.000000</scale>
<extra>
<node name="joint2" id="joint2" sid="joint2" type="JOINT">
<translate sid="translate">2.000000 0.000000 0.000000</translate>
<rotate sid="rotateZ">0 0 1 0.000000</rotate>
<rotate sid="rotateY">0 1 0 0.000000</rotate>
<rotate sid="rotateX">1 0 0 0.000000</rotate>
<scale sid="scale">1.000000 1.000000 1.000000</scale>
<extra>
进展顺利!
Maya 关节 :
我的关节:
我想把一张照片,但作为新会员,我不被允许。在这种情况下,你必须相信我,在我的引擎中,关节与 Maya 中的关节位于相同的位置。
然后,我尝试从“动画”节点加载关节。问题是,我找不到任何 jointOrient。
<animation id="joint1-anim" name="joint1">
<animation>
<source id="joint1-translate.Y-output">
<float_array id="joint1-translate.Y-output-array" count="2">-2.000000 -2.000000</float_array>
<animation>
<source id="joint1-rotateZ.ANGLE-output">
<float_array id="joint1-rotateZ.ANGLE-output-array" count="2">0.000000 0.000000</float_array>
<animation id="joint2-anim" name="joint2">
<animation>
<source id="joint2-translate.X-output">
<float_array id="joint2-translate.X-output-array" count="2">2.000000 2.000000</float_array>
因此,加载关节后,它们看起来像这样:
这里有人可以帮忙吗?
谢谢。
(抱歉,因为我的声望不超过10个,所以我不可以放图片。)
I'm having trouble loading joint data information from 'animation' node of collada file.
First, I try to load joints from 'library_visual_scenes' :
The first 2 joints look like that :
<visual_scene id="" name="">
<node name="joint1" id="joint1" sid="joint1" type="JOINT">
<translate sid="translate">0.000000 -2.000000 0.000000</translate>
<rotate sid="jointOrientZ">0 0 1 90.000000</rotate>
<rotate sid="rotateZ">0 0 1 0.000000</rotate>
<rotate sid="rotateY">0 1 0 0.000000</rotate>
<rotate sid="rotateX">1 0 0 0.000000</rotate>
<scale sid="scale">1.000000 1.000000 1.000000</scale>
<extra>
<node name="joint2" id="joint2" sid="joint2" type="JOINT">
<translate sid="translate">2.000000 0.000000 0.000000</translate>
<rotate sid="rotateZ">0 0 1 0.000000</rotate>
<rotate sid="rotateY">0 1 0 0.000000</rotate>
<rotate sid="rotateX">1 0 0 0.000000</rotate>
<scale sid="scale">1.000000 1.000000 1.000000</scale>
<extra>
which went well !
Maya joints :
My joints :
I would like to put a picture but as a new member, i'm not allowed. You'll have to trust me on this case, in my engine, joints are in the same place as in maya.
Then, I try to load joints from 'animation' node. Here is the problem, I can't find any jointOrient.
<animation id="joint1-anim" name="joint1">
<animation>
<source id="joint1-translate.Y-output">
<float_array id="joint1-translate.Y-output-array" count="2">-2.000000 -2.000000</float_array>
<animation>
<source id="joint1-rotateZ.ANGLE-output">
<float_array id="joint1-rotateZ.ANGLE-output-array" count="2">0.000000 0.000000</float_array>
<animation id="joint2-anim" name="joint2">
<animation>
<source id="joint2-translate.X-output">
<float_array id="joint2-translate.X-output-array" count="2">2.000000 2.000000</float_array>
So after loading joints, they look like that :
Anybody here could help ?
Thanks.
(Sorry as I don't have more than 10 reputations, i'm not allowed to put pictures.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于为那些可能感兴趣的人找到了答案。
collada 中的 Visual_scene 节点将为您提供关节的绑定姿势。
因此,我将在结构中加载 Visual_Scene 关节坐标:
类似的东西:
然后我将创建“Pose”结构的另一个实例,并使用一个以 Pose 作为参数的构造函数:
因此在构造之后,bind_pose 来自Visual_scene 和 anim_pose 是相同的。
然后我将迭代library_animations中的所有动画节点,找到通道并感兴趣:
和目标关节。
这告诉我们(这就是我有点迷失的地方)我们将用源值替换目标值。
如果在通道节点中找到的源数据与目标数据相同,即: :
bind_pose.translation.x 加载 Visual_scene 数据后的值为 -3.0,但
我什么也不做。
如果源数据与目标数据不同,我只需将 anim_pose 替换为合适的值即可。
这几乎就是从 collada 正确加载动画关节所需要做的全部工作。
如果您发现这里有任何问题,请告诉我。
希望这会有所帮助。
I finally figured out the answer, for those who might be interested.
The visual_scene node from collada will give you the bind pose for your joints.
So, I'm going to load visual_scene joint coordinates in a structure :
Something like that :
Then I'm going to create another instanciation of "Pose" struct, with a constructor which take a Pose as parameter :
So after construction, bind_pose from visual_scene and anim_pose are the same.
Then I'm going to iterate through all the animation node in library_animations, find the channel and get interested with :
and the target joint.
This tell us (and that's where I was a little lost) that we are going to REPLACE the targeted value with the source value.
If the source data find in channel node is the same as the target data, ie. :
bind_pose.translation.x has -3.0 as a value after loading visual_scene data, and
I do nothing.
If the source data is different from the target data, I simply replace in anim_pose with the good value.
And that's pretty much all you have to do to properly load animated joints from collada.
If you see anything wrong here, please tell me.
Hope this will help.