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

Method rayCast

core/physics/PhysicsWorld.cpp:450–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, const Vec2& point2, void* data)
451{
452 AXASSERT(func != nullptr, "func shouldn't be nullptr");
453
454 if (func != nullptr)
455 {
456 if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
457 {
458 updateBodies();
459 }
460 RayCastCallbackInfo info = {this, func, point1, point2, data};
461
462 PhysicsWorldCallback::continues = true;
463 cpSpaceSegmentQuery(_cpSpace, PhysicsHelper::vec22cpv(point1), PhysicsHelper::vec22cpv(point2), 0.0f,
464 CP_SHAPE_FILTER_ALL, (cpSpaceSegmentQueryFunc)PhysicsWorldCallback::rayCastCallbackFunc,
465 &info);
466 }
467}
468
469void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect, void* data)
470{

Callers 8

onTouchesBeganMethod · 0.45
updateMethod · 0.45
onTouchEndedMethod · 0.45
touchesEndedMethod · 0.45
onEnterMethod · 0.45
initMethod · 0.45

Calls 2

cpSpaceSegmentQueryFunction · 0.85
emptyMethod · 0.45

Tested by 6

onTouchesBeganMethod · 0.36
updateMethod · 0.36
onTouchEndedMethod · 0.36
touchesEndedMethod · 0.36
onEnterMethod · 0.36
initMethod · 0.36