简体   繁体   English

如何使用Helix Toolkit为简单的3D形状制作动画?

[英]How to animate a simple 3D shape using Helix Toolkit?

I'm trying to animate a simple rectangular shape so that it scales in size in a certain direction. 我正在尝试制作一个简单的矩形动画,以使其在特定方向上按比例缩放。 As it is, I am making a rectangle that extends from point A to B. The end goal is to animate it so that it starts at A and is transformed to be the length required to get to B. 照原样,我正在制作一个从点A延伸到点B 矩形。 最终目标是对其进行动画处理,以使其始于点A并转换为到达点B所需的长度。

I'm pretty new to animation in general, so this process seems finicky to me. 总的来说,我对动画还很陌生,所以这个过程对我来说似乎很棘手。

Right now I am: 现在我是:

Creating a vector between the start and end point
Finding the 8 corners of the rectangle along that vector
Creating 2 triangles for each face of the rectangle
Rendering the shape

This is all being done by using a MeshBuilder object and adding the triangles and points individually. 这全部通过使用MeshBuilder对象并分别添加三角形和点来完成。

So, the way I'm creating the prism doesn't really help for what I need to do. 因此,我创建棱镜的方式并不能真正帮助我完成所需的工作。 Ideally I suppose, I would just create a short prism aligned between the points, and then just extend the rectangle to be the right length in an animation. 理想情况下,我想我会创建一个在两点之间对齐的短棱镜,然后将矩形扩展为动画中的正确长度。

Any thoughts? 有什么想法吗?

I solved this is a sense by scaling the 3D object from a size of 0 in the X/Y/Z to 1.0. 我通过将3D对象从X / Y / Z中的0缩放到1.0来解决这个问题。 So instead of the prism "extending" from A to B, it more or less "grows" to B. 因此,它不是从A到B的“延伸”棱镜,而是或多或少地“生长”到B的棱镜。

Note that the ScaleTransform3D needed to have the CenterXYZ properties set to the coordinates of point A in order for it to be anchored to the correct position. 需要注意的是ScaleTransform3D需要有CenterXYZ设置为点A的坐标属性,以便它锚定到正确的位置。

If I find a better solution, I'll update this answer later. 如果找到更好的解决方案,我将在以后更新此答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM