liblashgame

Pathfinder and path decision making library for 2D tile game
git clone git://holbrook.no/liblashgame.git
Info | Log | Files | Refs

surfacecollision.c (643B)


      1 // test lash_game_standard : lash_collisionSurfaceSimple()
      2 
      3 #include "../lash_game_standard.h"
      4 #include <stdio.h>
      5 #include <stdlib.h>
      6 #include <math.h>
      7 
      8 int main(int argc, char *argv[]) {
      9 	if (argc < 5) {
     10 		printf("Usage: %s obj_vel obj_rad_in_degrees surface_rad_in_degrees bounce_factor\n", argv[0]);
     11 		return 1;
     12 	}
     13 
     14 	float objv = atof(argv[1]);
     15 	float objr = (atof(argv[2]) * M_PI) / 180.f;
     16 	float surr = (atof(argv[3]) * M_PI) / 180.f;
     17 	float bounce = atof(argv[4]);
     18 	
     19 	lash_collisionSurfaceDeflectSimple(&objv, &objr, surr, bounce);
     20 	
     21 	printf("velocity %f, degrees %f\n", objv, (lash_normalizeRadians(objr) * 180) / M_PI);
     22 	
     23 	return 0;
     24 }