MCPcopy Create free account
hub / github.com/axmolengine/axmol / cpSpaceSegmentQueryFirst

Function cpSpaceSegmentQueryFirst

3rdparty/chipmunk/src/cpSpaceQuery.c:155–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155cpShape *
156cpSpaceSegmentQueryFirst(cpSpace *space, cpVect start, cpVect end, cpFloat radius, cpShapeFilter filter, cpSegmentQueryInfo *out)
157{
158 cpSegmentQueryInfo info = {NULL, end, cpvzero, 1.0f};
159 if(out){
160 (*out) = info;
161 } else {
162 out = &info;
163 }
164
165 struct SegmentQueryContext context = {
166 start, end,
167 radius,
168 filter,
169 NULL
170 };
171
172 cpSpatialIndexSegmentQuery(space->staticShapes, &context, start, end, 1.0f, (cpSpatialIndexSegmentQueryFunc)SegmentQueryFirst, out);
173 cpSpatialIndexSegmentQuery(space->dynamicShapes, &context, start, end, out->alpha, (cpSpatialIndexSegmentQueryFunc)SegmentQueryFirst, out);
174
175 return (cpShape *)out->shape;
176}
177
178//MARK: BB Query Functions
179

Callers 1

updateFunction · 0.85

Calls 1

Tested by

no test coverage detected