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

Function dCollide

3rd_party/Src/ode/ode/src/collision_kernel.cpp:164–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162
163
164int 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

Callers 4

space_geom_colliderFunction · 0.85
dCollideUserGeomWithGeomFunction · 0.85
dCollideTransformFunction · 0.85
CollideIntoGroupFunction · 0.85

Calls 1

CONTACTFunction · 0.70

Tested by

no test coverage detected