Question by
aidinz · Jun 10, 2017 at 07:07 PM ·
ioscollision detection
Collision detection not working on iOS (Works on Desktop, Editor and Android)
Hi,
Title says it all. I use RayCasts to detect collision. Here is my code:
void FindAndStoreKilledNinjasInMyLastDash (Vector2 dashStart, Vector2 dashEnd)
{
// Raycast to find all ninjas that was in our dash path.
RaycastHit2D[] hits = new RaycastHit2D[100];
int numOfColliedEnemies = Physics2D.LinecastNonAlloc (dashStart, dashEnd, hits, (1 << LayerMask.NameToLayer ("Enemy")));
//Debug.DrawRay(dashStartPosition , transform.position - dashStartPosition, Color.cyan);
Debug.DrawLine (dashStart, dashEnd);
if (numOfColliedEnemies > 0)
{
for (int i = 0; i < numOfColliedEnemies; ++i)
{
// Destroy( hits[i].transform.gameObject);
AddThisNinjaToKilledEnemiesInLastDash (hits [i].collider);
}
// Debug.Log("inja");
}
}
Comment
Your answer
Follow this Question
Related Questions
How do I make my game look clean on IOS? 0 Answers
iOS build on iPhone XS starts with a pinkish flash after which game lags heavily. 0 Answers
Can't build with simulator SDK selected! 2 Answers
ios build times slow for now reason 0 Answers
Redirect to specific scene when App is opened from FCM notification in iOS 0 Answers