[英]Ursina, create a 3D animation
I would like to create an animation in 3D with Ursina.我想用 Ursina 在 3D 中创建一个 animation。 Each frame of the animation is a 3D file that I join in a directory. animation 的每一帧都是我在目录中加入的 3D 文件。 Here is my code:这是我的代码:
model = Entity(model="animation_walk/Pokemon_dresseur1.obj", collider="mesh", texture="Texture_dresseur.png", position=(-2, -9.5, 0), flipped_faces=False, double_sided=True,animations=[Animation('animation_walk/Pokemon_dresseur', 1, 24)])
model.animation_speed = 2
model.animate('animation_walk/Pokemon_dresseur', 1, loop=True)
But I don't really know how to use function animate().但我真的不知道如何使用 function animate()。 It need a value and a name but I'm not sure of what I need to write.它需要一个值和一个名称,但我不确定我需要写什么。 Indeed, when I run this code, I have this error message which explain that 'animation_walk/Pokemon_dresseur' is not defined in model:事实上,当我运行这段代码时,我收到了这条错误消息,它解释了 model 中未定义“animation_walk/Pokemon_dresseur”:
AttributeError: 'Entity' object has no attribute 'animation_walk/Pokemon_dresseur'
I tried to put a dict instead of a list to define animations put it no longer works.我试图用字典而不是列表来定义动画,但它不再有效。 So if someone have an idea, it's with pleasure.因此,如果有人有想法,那是很高兴的。 Thank you in advance.先感谢您。 Jules朱尔斯
You can use FrameAnimation3d, https://www.ursinaengine.org/api_reference.html#FrameAnimation3d .您可以使用 FrameAnimation3d, https://www.ursinaengine.org/api_reference.html#FrameAnimation3d 。
FrameAnimation3d('blob_animation_')
Or use panda3d's actor class (recommended)或者使用panda3d的actor class(推荐)
.animation will change properties smoothly. .animation 将顺利更改属性。 You can always check ursina API reference.您可以随时查看 ursina API 参考资料。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.