-1

I would like to create an animation in 3D with Ursina. Each frame of the animation is a 3D file that I join in a directory. 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(). 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:

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

1 Answers1

0

You can use FrameAnimation3d, https://www.ursinaengine.org/api_reference.html#FrameAnimation3d .

FrameAnimation3d('blob_animation_')

Or use panda3d's actor class (recommended)

.animation will change properties smoothly. You can always check ursina API reference.

Lixt
  • 201
  • 4
  • 19
  • Thanks for your answer, I forgot to delete this question after succeding. I also wonder if it would be possible to change the animation of my character when I click on A for example. But I don’t think it’s possible to change the frames, at least I didn’t succeed. If someone has an idea, I’m a taker. – Jules Bourillon Jan 04 '23 at 14:57
  • Yes. You can use panda3d's actor. See the panda docs. – Lixt Jan 04 '23 at 17:28