Skip to content

Instantly share code, notes, and snippets.

@zaphire
Created April 2, 2011 05:03
Show Gist options
  • Save zaphire/899245 to your computer and use it in GitHub Desktop.
Save zaphire/899245 to your computer and use it in GitHub Desktop.
int y = 0;
int max = 16;
for (y = 0; y < max; y++)
{
CollisionData collisionData;
if (!Collide("Obstruction", &collisionData))
{
break;
}
printf("normal %f, %f\n", collisionData.normal.x, collisionData.normal.y);
if (abs(collisionData.normal.y) < 0.5f)
{
Debug::Log("too steep");
position = lastPosition;
break;
}
position.y = lastPosition.y - y;
velocity.y = 0;
}
if (y == max)
{
position = lastPosition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment