MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / dJointAttach

Function dJointAttach

3rd_party/Src/ode/ode/src/ode.cpp:1085–1130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1083
1084
1085void dJointAttach (dxJoint *joint, dxBody *body1, dxBody *body2)
1086{
1087 // check arguments
1088 dUASSERT (joint,"bad joint argument");
1089 dUASSERT (body1 == 0 || body1 != body2,"can't have body1==body2");
1090 //dxWorld *world = joint->world;
1091 //dUASSERT ( (!body1 || body1->world == world) &&
1092 // (!body2 || body2->world == world),
1093 // "joint and bodies must be in same world");
1094
1095 // check if the joint can not be attached to just one body
1096 dUASSERT (!((joint->flags & dJOINT_TWOBODIES) &&
1097 ((body1 != 0) ^ (body2 != 0))),
1098 "joint can not be attached to just one body");
1099
1100 // remove any existing body attachments
1101 if (joint->node[0].body || joint->node[1].body) {
1102 removeJointReferencesFromAttachedBodies (joint);
1103 }
1104
1105 // if a body is zero, make sure that it is body2, so 0 --> node[1].body
1106 if (body1==0) {
1107 body1 = body2;
1108 body2 = 0;
1109 joint->flags |= dJOINT_REVERSE;
1110 }
1111 else {
1112 joint->flags &= (~dJOINT_REVERSE);
1113 }
1114
1115 // attach to new bodies
1116 joint->node[0].body = body1;
1117 joint->node[1].body = body2;
1118 if (body1) {
1119 joint->node[1].next = body1->firstjoint;
1120 body1->firstjoint = &joint->node[1];
1121 }
1122 else joint->node[1].next = 0;
1123 if (body2) {
1124 joint->node[0].next = body2->firstjoint;
1125 body2->firstjoint = &joint->node[0];
1126 }
1127 else {
1128 joint->node[0].next = 0;
1129 }
1130}
1131
1132
1133void dJointSetData (dxJoint *joint, void *data)

Callers 15

dTestDataStructuresFunction · 0.85
attachMethod · 0.85
CollideIntoGroupFunction · 0.85
InitContactMethod · 0.85
CreateBallMethod · 0.85
CreateHingeMethod · 0.85
CreateHinge2Method · 0.85
CreateSliderMethod · 0.85
CreateFullControlMethod · 0.85
CPhysicsShellAnimatorMethod · 0.85

Tested by

no test coverage detected