How do I get orxBODY_JOINT?

edited April 2012 in Help request
I need to remove a joint by code. I can get orxBODY by using orxOBJECT_GET_STRUCTURE, but I can't figure out how to get the joint I want to remove (as it is needed by orxBody_RemoveJoint). How can I achieve this?

EDIT:
Ahh just after I posted I realized I missed the orxBody_GetNextJoint function. Sorry.

Comments

  • edited April 2012
    No worries! And yes, that's the way to iterate over them.

    You've probably already found orxBody_GetJointName() which will allow you to select the correct joint before removal but I thought I'd mention it here if someone is looking for those in the future. :)
  • edited April 2012
    Hm, seems like something's not working for me.
    orxBODY *body = orxOBJECT_GET_STRUCTURE(neck, BODY);
    orxBODY_JOINT *joint = orxBody_GetNextJoint(body, orxNULL);
    orxLOG("JOINT NAME %s", orxBody_GetJointName(joint));
    while(orxString_Compare(orxBody_GetJointName(joint), "HeadNeckJoint") != 0){
    joint = orxBody_GetNextJoint(body, joint);
    orxLOG("JOINT NAME %s", orxBody_GetJointName(joint));
    }
    orxBody_RemoveJoint(joint);
    

    It gets the first joint from the list correctly, but the next one returns orxNULL (and the ChildJointList for my object has 3 more joints).
  • edited April 2012
    Mmh, I had a quick glance at the orxBody_GetNextJoint() code but I don't see any obvious bug. Can you trace inside that call in debug and see how many joints are actually stored on the body (there are two lists to check: stSrcJointList and stDstJointList).

    Also, if you turn Physics.ShowDebug to true in config, do you see the joints being displayed?
  • edited April 2012
    Uh, didn't do much debugging so I don't know how to get inside the function and make a breakpoint there (when I click 'Go to definition' in VS it directs me to the header file)?

    Yes, the joints are displayed.
  • edited April 2012
    Ah no worries, if you can send me a zip of your project in private I can have a look for you tonight.
    I can also write the example I owe you directly in your code in that case. ;)
  • edited April 2012
    There was an obvious bug in the function, really not sure how I didn't see it before. I guess I need to get some sleep.

    Well now it's fixed but you'll need to use the SVN version. :)
  • edited April 2012
    Sorry about late reply but I had quite a bit of work. Now everything works perfectly. Much thanks!
  • edited April 2012
    My pleasure! Glad it's now working fine!
Sign In or Register to comment.