Explorar el Código

rcamera: move y clamp to before 3d projection (#2905)

pull/2907/head
Ian McFarlane hace 2 años
cometido por GitHub
padre
commit
b9e49cdca6
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 1 ficheros con 3 adiciones y 4 borrados
  1. +3
    -4
      src/rcamera.h

+ 3
- 4
src/rcamera.h Ver fichero

@ -405,6 +405,9 @@ void UpdateCamera(Camera *camera)
} break;
case CAMERA_FIRST_PERSON: // Camera moves as in a first-person game, controls are configurable
{
// NOTE: On CAMERA_FIRST_PERSON player Y-movement is limited to player 'eyes position'
camera->position.y = CAMERA.playerEyesPosition;
camera->position.x += (sinf(CAMERA.angle.x)*direction[MOVE_BACK] -
sinf(CAMERA.angle.x)*direction[MOVE_FRONT] -
cosf(CAMERA.angle.x)*direction[MOVE_LEFT] +
@ -479,10 +482,6 @@ void UpdateCamera(Camera *camera)
camera->target.y = camera->position.y - matTransform.m13;
camera->target.z = camera->position.z - matTransform.m14;
// Camera position update
// NOTE: On CAMERA_FIRST_PERSON player Y-movement is limited to player 'eyes position'
camera->position.y = CAMERA.playerEyesPosition;
// Camera swinging (y-movement), only when walking (some key pressed)
for (int i = 0; i < 6; i++) if (direction[i]) { swingCounter += GetFrameTime(); break; }
camera->position.y -= sinf(2*PI*CAMERA_FIRST_PERSON_STEP_FREQUENCY*swingCounter)*CAMERA_FIRST_PERSON_SWINGING_DELTA;

||||||
x
 
000:0
Cargando…
Cancelar
Guardar