Fix bug where camera view would drag behind player movement when strafing.
This commit is contained in:
parent
497efc6fbf
commit
0f2a5f4e15
@ -47,7 +47,7 @@ void Morault::Gameplay::PlayerController::UpdatePlayerController(bool focus, Mor
|
||||
rotation = Vector3RotateByAxisAngle(rotation, { 0,1,0 }, -GetMouseDelta().x * 0.05 * sensitivityMultiplier);
|
||||
rotation.y = Clamp(rotation.y - GetMouseDelta().y * 0.3 * sensitivityMultiplier, -15, 15);
|
||||
|
||||
camera.target = Vector3Add(camera.position, rotation);
|
||||
|
||||
if (IsKeyDown(KEY_W)) camera.position = Vector3Add(camera.position, Vector3Multiply({rotation.x, 0, rotation.z}, {GetFrameTime(), GetFrameTime(), GetFrameTime()}));
|
||||
if (IsKeyDown(KEY_S)) camera.position = Vector3Subtract(camera.position, Vector3Multiply({ rotation.x, 0, rotation.z }, { GetFrameTime(), GetFrameTime(), GetFrameTime() }));
|
||||
|
||||
@ -59,7 +59,11 @@ void Morault::Gameplay::PlayerController::UpdatePlayerController(bool focus, Mor
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
rotation = { 0,0,0 };
|
||||
}
|
||||
|
||||
camera.target = Vector3Add(camera.position, rotation);
|
||||
for (int i = 0; i < map->MapTriangles.size(); i++) {
|
||||
if (CheckCollisionPointTriangle({ camera.position.x / renderScale, camera.position.z / renderScale }, map->MapTriangles[i].a, map->MapTriangles[i].b, map->MapTriangles[i].c)) {
|
||||
collfloor = map->MapTriangles[i].heightFloor * renderScale + 5;
|
||||
|
Loading…
x
Reference in New Issue
Block a user