Sample skeletal mesh

Hello!

I’ve been playing around with Panda3d for a several weeks. Unfortunately, I’ve become stuck when it comes to getting custom content to import. I’m running Blender 2.53 and using yesterday’s Panda3d 1.7.1 Windows build because I read there was a change to the dea2egg program. Blender 2.5 doesn’t work with Chicken so I’ve been using dae format to go back and forth between Panda3d and Blender.

Does anyone have an example .blend or .dae file that contains a skeletal mesh? Ralph or Eve would be perfect examples since I understand how they work from the tutorials. I have been able to attach and remove items from their hands.

What I’m trying to do is import a simple little car model into Panda3d, import a simple tire, and then attach a copy of the tire to each wheel well. I figured this would be rather easy to do, but I can’t quite seem to figure out how to make it work. I think the problem is that I’m not setting up the armature correctly in Blender. I haven’t done this before in Blender so I’ve probably missed something. It’s a lot different from how Maya works (can’t use it anymore).

From my testing python file:

  File "car.py", line 61, in __init__
    self.tire.reparentTo(self.car.exposeJoint(None, "modelRoot", "wheel_rr"))
TypeError: NodePath.reparentTo() argument 1 must be NodePath, not NoneType

From dae2egg.exe:

Reading vehicletest.dae
:daeegg(warning): Unsupported entity type found
:daeegg(warning): Unsupported entity type found
Writing vehicletest.egg

Thanks for any help!

Look in the EGG file and make sure there actually exists a entry named “wheel_rr”.
Maybe it has not been exported, or got exported as a instead.
Also, are you loading the car as an Actor or just a model?

Looks like it’s actually named Armature_wheel_rr. I gave that a try and still get the following error:

Here is the little bit of code that should actually make the car and wheel appear. I can get the wheel to appear as long as I don’t try to place it where it belongs. In the future I’m going to create 4 wheels and attach them, but at the moment I’m stuck just getting one to attach. Eventually they will rotate and the player will be able to select from a set of wheel options…but first things first. None of that can happen until one wheel is attached. The error output shows a problem with “None” in the exposeJoint() call, but the Eve examples worked just fine like that.

    self.car = Actor("models/cartest")
    self.car.reparentTo(render)

    self.wheel = Actor("models/wheeltest")
    #self.wheel.reparentTo(render)
    self.wheel.reparentTo(self.car.exposeJoint(None, "modelRoot", "Armature_wheel_rr"))

Here is an excerpt from the cartest.egg file that shows the skeleton part. As is it doesn’t seem to work. I removed the group tag and undid indentation, but that had no effect. I’m rather confused as to what’s wrong. It appears the skeletal nodes are there as far as I can tell.

<Group> Armature {
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 -0.911563 1
    }
  }
  <Joint> Armature_axel_r {
    <Transform> {
      <Matrix4> {
        -1 -8.74228e-008 -1.50156e-007 0
        1.02758e-007 -0.994433 -0.105371 0
        -1.40108e-007 -0.105371 0.994433 0
        1.19209e-007 -6.1749e-008 0.222133 1
      }
    }
    <Joint> Armature_wheel_rr {
      <Transform> {
        <Matrix4> {
          0.000854218 0.997087 0.0762733 0
          -0.999573 0.00307969 -0.0290647 0
          -0.0292149 -0.0762159 0.996663 0
          0 1.84555 -1.88743e-009 1
        }
      }
    }
    <Joint> Armature_wheel_lr {
      <Transform> {
        <Matrix4> {
          0.000136918 -0.995597 -0.0937341 0
          0.999932 0.00123245 -0.0116298 0
          0.0116942 -0.0937261 0.995529 0
          0 1.84555 -1.88743e-009 1
        }
      }
    }
  }
  <Joint> Armature_axel_f {
    <Transform> {
      <Matrix4> {
        -1 -1.94859e-008 8.74228e-008 0
        -3.06048e-008 0.991638 -0.129049 0
        -8.41771e-008 -0.129049 -0.991638 0
        1.19209e-007 -6.1749e-008 0.222133 1
      }
    }
    <Joint> Armature_wheel_rf {
      <Transform> {
        <Matrix4> {
          0.000307576 -0.993749 0.111637 0
          -0.999846 -0.00226353 -0.0173944 0
          0.0175383 -0.111614 -0.993597 0
          0 1.78947 1.0047e-008 1
        }
      }
    }
    <Joint> Armature_wheel_lf {
      <Transform> {
        <Matrix4> {
          0.000307576 0.993749 -0.111637 0
          0.999846 -0.00226357 -0.0173947 0
          -0.0175386 -0.111614 -0.993597 0
          0 1.78947 1.0047e-008 1
        }
      }
    }
  }
}

Thanks for your help! :slight_smile:

Well let’s fix up the warnings, that is likely a good indicator of the problem.
The wheel does not need to be an Actor, you can load it as a regular model with

loader.loadModel('models/wheeltest')

.
The car EGG is missing a critical line which basically tells it to be an Actor. The top Group node should have a “Dart” flag on it, like this:

<Group> Armature {
  <Dart> { 1 }
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 -0.911563 1
    }
  }
  <Joint> Armature_axel_r {
    <Transform> {
      <Matrix4> {
        -1 -8.74228e-008 -1.50156e-007 0 
        ...

I don’t use Blender so I can’t say how to get it to export with this flag, but you can add it manually to the EGG file for now to see if that is the problem.

I manually added the { 1 }. When that is on the car’s egg file it causes the mesh to fail to appear. However, the wheel will appear even when using the exposeJoint() command. Unfortunately, I haven’t figured out how to get the car mesh to appear or what caused it to disappear. There is no error output this time. :confused:

[color=red]EDIT:
I’ve got things semi-working now. I didn’t realize there was a punzip.exe sitting in the binaries folder. I used that to decompress the Eve egg file and took a look at it. Its structure is significantly different from the cartest file I’ve been playing with. The dae2egg tool output multiple groups and failed to encapsulate them all under a single group tag. That’s why the { 1 } wasn’t working. I simply added a new group tag to surround all the model information, added in the dart tag, and it worked.

However, now the wheel is attaching incorrectly. This appears to be my error. I can fix this one! I just need to redo the skeleton/nodes. It’ll look funny in Blender, but that’s alright.

Thanks for your help! :slight_smile: