Collisions can be tested in ScrollObjects using the OnCollide
function. The incoming _poCollider
is the ScrollObject that is colliding with this
ScrollObject.
Also, the individual parts of both ScrollObjects that are colliding are available in the function.
void Enemy::OnCollide(ScrollObject *_poCollider, orxBODY_PART *_pstPart, orxBODY_PART *_pstColliderPart, const orxVECTOR &_rvPosition, const orxVECTOR &_rvNormal) { if (_poCollider == orxNULL) { return orxTRUE; } const orxSTRING colliderName = _poCollider->GetName(); if (orxString_SearchString(colliderName, "Ship") != orxNULL) { const orxSTRING shipPartName = orxBody_GetPartName(_pstColliderPart); const orxSTRING enemyPartName = orxBody_GetPartName(_pstPart); } } }