Actor Animation Problem

Hello Everyone, i have been trying to make an simple running animation using the Panda3D Actor class and integrate it with Ursina, i exported the rigged player model(used mixamo auto rigger) from blender to an obj format and imported and also exported the Running Animation as a gltf file but i faced this error: :Actor(warning): Player.obj is not a character!
Traceback (most recent call last):
File “C:\Adam\app.py”, line 12, in
actor.loop(‘Running’)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python312\Lib\site-package
s\direct\actor\Actor.py”, line 1568, in loop
for control in self.getAnimControls(animName, partName):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python312\Lib\site-package
s\direct\actor\Actor.py”, line 1860, in getAnimControls
animControl = self.__bindAnimToPart(
^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python312\Lib\site-package
s\direct\actor\Actor.py”, line 2366, in __bindAnimToPart
bundle = self.__commonBundleHandles[subpartDef.truePartName].getBundle()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: ‘modelRoot’, can anyone help and btw that is the code i used :

from ursina import *
from ursina.shaders import *
from direct.actor.Actor import *

app = Ursina()

Player = Entity(color=color.yellow, shader=basic_lighting_shader)

actor = Actor('AI.obj', {'Running': 'Running.gltf'})

actor.reparent_to(Player)


def update():
    if held_keys['r']:
        actor.loop('Running')
    if held_keys['e']:
        actor.stop()

EditorCamera()

DirectionalLight(shadows=True)

Sky(texture='sky_sunnest')

app.run()

Greetings, and welcome to the forums! I hope that you find your time here to be positive! :slight_smile:

I’m not sure that the “obj” format supports armatures. As such, I don’t think that it’s likely to work for your purposes.

(Hence the warning: the Actor class is reporting that the model-file doesn’t have the capacity for skeletal animation, I believe.)

Why not just export both model and animation as glTF files?

I tried to export both as gltf file but the same error happened, also tried bam but it didn’t work someone in the Panda3D discord server told me to export the Sketal(bones) and the Player Model(Mesh) in the Player obj file and the animation data in the gltf file but i don’t know if this gonna work or not

When you exported to glTF, did you have both the model and the skeleton selected?

(That might have been what the person in Discord meant: that you had to have both selected when exporting, not that you should use the “obj” format.)

Otherwise, you might try the “blend2bam” command-line tool.

See the following manual page for more information and links on these options:
https://docs.panda3d.org/1.10/python/pipeline/converting-from-blender

It is no longer necessary to select specific things before exporting (unless checking “selected only” in the exporter settings).

1 Like

No when I exported to gltf I have only the animation and the skeleton(because I couldn’t delete the Skelton in blender) so the obj file have a skeleton and also the gltf file have another skeleton, the problem is not with obj or gltf or bam or egg or whatever, the problem is when I try to use 2 files instead of using only one file

I see–in that case, maybe the problem is that you’re doing as two different steps, rather than exporting to multiple files in one step. It may be that the exporter is seeing that there are no animations indicated when exporting the model, and so isn’t exporting the model as an animated object.

But that is a guess!

Wait an Actor class must be an Animated object, you mean if the object does not contain an animation it will not work

Not exactly: it is possible to use separate model and animation files. (That’s what I usually do.)

However, there is a difference between a model that’s set up to be animated and one that isn’t–even if no actual animations are present–and Panda isn’t able to use the latter type in place of the former type.

Thus, if the model wasn’t exported with the setup to be animated, it won’t be usable with animations.

Now, I’m not familiar with the modern workflows–I still use an old version of both Blender and YABEE–so I’m not in a position to tell you how to export properly. But there should be away to achieve what you want.

Ok, thanks I found the error, “obj doesn’t support skeleton)

1 Like

That is… pretty much what I said in my first reply. :stuck_out_tongue:

But I’m glad that you found the problem! :slight_smile:

1 Like

In order not to get lost in this topic further, you can check this table.

https://docs.panda3d.org/1.10/python/pipeline/model-file-formats#supported-feature-table

1 Like