[odejava] How to use Body.getJoints()

Hello to all!
I’m currently wondering how to use the Body.getJoints() function. I concluded from the documentation that it returns a java.util.List with Joints but actually it returns a list with SWIGTYPE_p_dJointID’s.
But I couldn’t find any way to ‘convert’ this ID into a propper point reference?
Is this a bug or is did I missunderstud something ?

Greetings,
Marcus

The only way to convert the ID into a Java object is to maintain lookup tables. I do this for contact, so you can get the Body and not just the ID.

In this case, probably the simplist way would be to forget about the ID altogether – the less native stuff the better, and simply have a two protected method of Body which are used to record when that body gets attached and removed to/from a joint. A fairly easy change to make really.

How urgent is this for you?

Will.

Hi William,

<<In this case, probably the simplist way would be to forget about the ID altogether – the less native stuff the better, and simply have a two protected method of Body which are used to record when that body gets attached and removed to/from a joint.>>
I’m not shure what you mean, but as far as I understand I need to:

  1. create the joint (of course attach it)
  2. query it’s ID with … hmm, no method in the Joint class for this. How do I get the joint ID ?
  3. When I somehow got the ID I put it into a hashtable (or whatever) to enable classes without reference to this joint to get it from the lookup table.

<<How urgent is this for you?>>
Oh, I have created an ugly workaround. Basically I put the bodies joints into the “userObject” slot.
I have created a supporting wrapper class for this, as I also need access to the joints angular motors. So I put a list of joints and AMotors into the wrapper and then call body.setUserData(wrapper).
I don’t like that very much, as it is, in a way, not type save and might also be easyly overwritten by other classes.
It would be really nice to reflect the conceptual hierarcy via
Joint[] Body.getJionts() and AMotor[] Joint.getMotors() -> By the way is it possible at all to put more than one motor in a joint ?

Ok, back to your question, it is not particular urgent, as im my case I would need to stick with the old workaround until I can also access the AMotors from a given Joint reference. But for me it feels like there is something like a (little) “gap” in the API.

Greetings,
Marcus

Ok, it’s on my buglist. Feel free to bump this thread if I don’t have it fixed in a week or two.

Will.