Skip to content

Commit 4ff555a

Browse files
committed
attempting to move camera, why isn't it possible
1 parent 73403a0 commit 4ff555a

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/raylib_game

0 Bytes
Binary file not shown.

src/raylib_game.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,29 @@ void UpdateDrawFrame(Camera3D camera, Clock *clock, Snake *snake)
143143
{
144144
printf("\ntick - ");
145145
MoveSnake(snake);
146+
printf(TextFormat("\thead: {%f, %f, %f}", snake->body[0]->x, snake->body[0]->y, snake->body[0]->z));
146147

147148
// printf("\tupdate camera - ");
148149
camera.position = Vector3Add(*snake->body[0], cameraNeck);
149150
camera.target = Vector3Add(camera.position, snake->forward);
150151
camera.up = snake->up;
151-
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
152152
}
153153

154+
// UpdateCamera(&camera, CAMERA_FREE);
155+
UpdateCameraPro(&camera,
156+
(Vector3){
157+
(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP)) * 0.1f - // Move forward-backward
158+
(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN)) * 0.1f,
159+
(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT)) * 0.1f - // Move right-left
160+
(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT)) * 0.1f,
161+
0.0f // Move up-down
162+
},
163+
(Vector3){
164+
0.f,
165+
0.f,
166+
0.0f},
167+
1.f); // Move to target (zoom)
168+
154169
// Draw
155170
//----------------------------------------------------------------------------------
156171
// Render game screen to a texture,

src/snake.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ void DrawSnake(Snake *snake)
111111
{
112112
for (int i = 0; i <= snake->tailIndex; i++)
113113
{
114-
// printf(TextFormat("\tbody[%i]: {%d, %d, %d}", i, snake->body[i]->x, snake->body[i]->y, snake->body[i]->z));
115114
DrawCubeV(*snake->body[i], SEGMENT_SIZE, PURPLE);
116115
}
117116
}

0 commit comments

Comments
 (0)