Parenting collision node to a joint?

Is there a way to attach the collision node into one of the actor joint ?

It seems that the joint is not a node after all. … to_a_Joint

I noticed the exposeJoint but failed to reparent the collision node into the joint. Maybe something wrong in the parameters.

If that’s the only way, i’m gonna recheck on that.


Great it works!!!

here’s the code


some confusion in the None and the ‘modelRoot’ parameters, which make me in doubt to use this exposeJoint function

i prefer it would be like this


when will we need to change the ‘modelRoot’ anyway …

Anyway anyway thanks to rdb :wink:

The function parameters are in their less-than-optimal order for historical reasons. It is a little weird that the most important parameter is the third one, but it is difficult to change now without invalidating existing code. (I guess we could make all the parameters optional, and allow you to specify a keyword parameter, but that would mean we’d need a default for the jointName parameter too, which would also cause confusion.)

Anyway, it’s not a frequently used method, so I’m not too anxious about the confusing interface.

For the record, the first parameter is occasionally used when you want to manipulate an already-existing NodePath, instead of creating a new one. This is particularly important when you have multiple LOD’s and you want each LOD joint to control the same node. The second parameter is used when you have a multi-part or sub-part Actor. (Both of these properties were true of all of our Actors in the early days of Panda and Toontown, which is why the interface made sense originally.)

I think getJoint() would be a poor choice for a name, because it sounds like a simple accessor that does nothing and can be safely called repeatedly; when in fact this method performs a specific constructive operation and should be called only once per joint you want exposed.


just create a new function like “useJoint” ?

Yeah, that’s a fine path forward. But then we have two functions that do the same thing, which also contributes to confusion. We can call the old function deprecated, but it would be years before we could safely remove it, if ever.

If I thought the problem was serious enough, I’d go ahead and do it anyway, but I think in this case we can live with a few odd parameters at the beginning of an occasionally-used function call.


yes you are right.

Is that mean that this function is seldom to be used?
But IMHO I think exposeJoint is great function and very usefull.

I’ve been doing research on the collision node. If we parent the collision node into the actor. And having the actor animate jumping upward about 100 feet, the collision node stay on the ground. That’s because the actor is not moving but the animation make the skeleton move upward.

If we parent the collision to the ‘center of mass’ of the joint skeleton then we’ll get what we really want.

It’s usefull too when you need to parent a collision node into the arm that will do a jab punch.

Well i think i will use that frequently, despite of the un-user-friendliness grammar. :slight_smile:

Note that you can also use the -expose parameter of egg-optchar to achieve the same thing. :slight_smile: