sanchofx1
Senior Newbie 
Java games rock!
|
 |
«
Reply #2 - Posted
2005-03-02 10:02:35 » |
|
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
|