Creating a collision solid in an egg file [SOLVED]

I’m trying to create a collision sphere around a model so that I can eventually set up mouse picking wtih a collision ray. I added a collision tag to the beginning of the egg file as follows

<Group> BasicKid {
  <Collide> BasicKid {Sphere descend}
  <Dart> { 1 }
  <Group> groundPlane_transform {
  }
  <Group> group {
    <Group> "BasicKid_v001:default1" {
      <VertexPool> "BasicKid_v001:defaultShape.verts" {
        <Vertex> 0 {
          -0.07105 1.5 -0.079794
          <UV> { 0.233073 0.0620905 }
          <Normal> { -0.502431 0.040969 -0.863646 }
          <RGBA> { 1 1 1 1 }
          // Neck:1
        }

I put the tag immediately under the group tag, like it is in the maze.egg file for the ball in maze tutorial. The problem I’m running into is that when I use

print(self.actor.find(“BasicKid”)

or

print(self.actor.find("**/BasicKid")

the console prints out not found.

As you can see in the egg file, the group definitely exists. I don’t understand why the .find method isn’t finding that group. Any ideas what I’m doing wrong?

I just got the idea to try

print(self.actor.find("**")

and the resulting printout from the console was

render/BasicKid

This just reaffirms my belief that “**/BasicKid” should be finding the group I’m after. I’m totally stumped on this one, if anyone can help me out that’d be great.

Unfortunately, collisions in egg files only work with static models, not with animatable models. Since you have the “” tag in this egg file, which you need in order to load the model with the Actor interface, it means you can’t also load collisions from the same egg file. You will have to load the collisions from a different egg file and parent them together.

(Actually, 1.7.0 will provide an alternate way to load an egg file that supports collisions in animatable models. But there is a cost to this too.)

David

Okay, I wasn’t aware of that restriction. I’m working on a method to get around it by creating collision spheres with code and parenting them to a root node the actor is also parented too, like how the collision ray is handled in the ball in maze tutorial. Thanks for helping me out again, David.