| 162 | |
| 163 | |
| 164 | int dCollide (dxGeom *o1, dxGeom *o2, int flags, dContactGeom *contact, |
| 165 | int skip) |
| 166 | { |
| 167 | dAASSERT(o1 && o2 && contact); |
| 168 | dUASSERT(colliders_initialized,"colliders array not initialized"); |
| 169 | dUASSERT(o1->type >= 0 && o1->type < dGeomNumClasses,"bad o1 class number"); |
| 170 | dUASSERT(o2->type >= 0 && o2->type < dGeomNumClasses,"bad o2 class number"); |
| 171 | |
| 172 | // no contacts if both geoms are the same |
| 173 | if (o1 == o2) return 0; |
| 174 | |
| 175 | // no contacts if both geoms on the same body, and the body is not 0 |
| 176 | if (o1->body == o2->body && o1->body) return 0; |
| 177 | |
| 178 | dColliderEntry *ce = &colliders[o1->type][o2->type]; |
| 179 | int count = 0; |
| 180 | if (ce->fn) { |
| 181 | if (ce->reverse) { |
| 182 | count = (*ce->fn) (o2,o1,flags,contact,skip); |
| 183 | for (int i=0; i<count; i++) { |
| 184 | dContactGeom *c = CONTACT(contact,skip*i); |
| 185 | c->normal[0] = -c->normal[0]; |
| 186 | c->normal[1] = -c->normal[1]; |
| 187 | c->normal[2] = -c->normal[2]; |
| 188 | dxGeom *tmp = c->g1; |
| 189 | c->g1 = c->g2; |
| 190 | c->g2 = tmp; |
| 191 | } |
| 192 | } |
| 193 | else { |
| 194 | count = (*ce->fn) (o1,o2,flags,contact,skip); |
| 195 | } |
| 196 | } |
| 197 | return count; |
| 198 | } |
| 199 | |
| 200 | //**************************************************************************** |
| 201 | // dxGeom |
no test coverage detected