control fix
This commit is contained in:
parent
646d1c9ed3
commit
0f38b89e1c
4 changed files with 15 additions and 7 deletions
10
control.c
10
control.c
|
@ -18,7 +18,7 @@ int collision(struct chunk chunk, vec3 pos, vec3 dir_temp, int col, int n) {
|
|||
return 1;
|
||||
}
|
||||
if (yd < 0 && n == 1) {
|
||||
dir_temp[1] = 0.015;
|
||||
dir_temp[1] = 0.015 / 2;
|
||||
pos[1] = closestVert[1];
|
||||
return 1;
|
||||
}
|
||||
|
@ -80,9 +80,13 @@ struct v3f control_handler(double cx, double cy, vec3 pos, vec3 dir_temp,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
vec3_add(pos, pos, dir_temp);
|
||||
|
||||
dir_temp[1] -= 0.03 * delta;
|
||||
int is_col = 0;
|
||||
if (collision(chunk, pos, dir_temp, col, 1)) {
|
||||
is_col = 1;
|
||||
col = 0;
|
||||
|
||||
off[1] = -2;
|
||||
|
@ -106,6 +110,10 @@ struct v3f control_handler(double cx, double cy, vec3 pos, vec3 dir_temp,
|
|||
struct v3f dirOut;
|
||||
vec3_dup(dirOut.pos, direction);
|
||||
|
||||
if (is_col && fabs(dir_temp[1]) < 0.1) {
|
||||
pos[1] -= dir_temp[1];
|
||||
}
|
||||
|
||||
return dirOut;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue