diff --git a/c3d.c b/c3d.c index 59567fd..b555110 100644 --- a/c3d.c +++ b/c3d.c @@ -16,7 +16,7 @@ const float WIDTHSCALE = (float)RENDERWIDTH / SCREENWIDTH; const float HEIGHTSCALE = (float) RENDERHEIGHT / SCREENHEIGHT; -const float fov = 90.0 / 180.0 * 3.14159265369; +const float fov = 70.0 / 180.0 * 3.14159265369; const float half_fov = fov / 2; float proj; //HALFWIDTH / tan(half_fov) Inited later @@ -93,11 +93,40 @@ void CtrlLocalCam(LocalCam *cam, float time) { //cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y); //cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y); } + if (IsKeyDown(KEY_S)) { + Vector3 forceForward = (Vector3){0,0,-500}; + Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y); + cam->velocity = Vector3Sum(cam->velocity,rotatedforce); + + //cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y); + //cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y); + } + + if (IsKeyDown(KEY_A)) { + Vector3 forceForward = (Vector3){-500,0,0}; + Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y); + cam->velocity = Vector3Sum(cam->velocity,rotatedforce); + + //cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y); + //cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y); + } + if (IsKeyDown(KEY_D)) { + Vector3 forceForward = (Vector3){500,0,0}; + Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y); + cam->velocity = Vector3Sum(cam->velocity,rotatedforce); + + //cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y); + //cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y); + } if(IsKeyDown(KEY_SPACE)) { cam->velocity.y = cam->velocity.y - 50; } + if(IsKeyDown(KEY_LEFT_SHIFT)) { + cam->velocity.y = cam->velocity.y + 50; + } + if (IsKeyDown(KEY_Q)){ cam->angleVelocity.y = cam->angleVelocity.y + time*1000; }