fix: separated run and weapon bob amplitude
This commit is contained in:
parent
e30758754c
commit
f646f70c37
|
@ -40,19 +40,19 @@ void PlayerCamera::update_offset() {
|
||||||
this->run_bob_time = 0.0;
|
this->run_bob_time = 0.0;
|
||||||
}
|
}
|
||||||
double wave{ Math::sin(this->run_bob_time) };
|
double wave{ Math::sin(this->run_bob_time) };
|
||||||
Vector3 offset{ Vector3{ float(wave), float(Math::abs(wave)), 0 } * this->run_bob_amplitude };
|
Vector3 offset{ Vector3{ float(wave), float(Math::abs(wave)), 0 } };
|
||||||
if (!is_running) {
|
if (!is_running) {
|
||||||
this->run_bob_time = MIN(this->run_bob_time, this->run_bob_blend_out);
|
this->run_bob_time = MIN(this->run_bob_time, this->run_bob_blend_out);
|
||||||
offset = offset.lerp(Vector3(), this->run_bob_time / this->run_bob_blend_out);
|
offset = offset.lerp(Vector3(), this->run_bob_time / this->run_bob_blend_out);
|
||||||
}
|
}
|
||||||
GETSET(position, {
|
GETSET(position, {
|
||||||
Basis const basis{ get_basis() };
|
Basis const basis{ get_basis() };
|
||||||
position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y * 5.0;
|
position = this->home + (basis.get_column(0) * offset.x + basis.get_column(1) * offset.y) * this->run_bob_amplitude_camera;
|
||||||
});
|
});
|
||||||
for (Variant child : get_children()) {
|
for (Variant child : get_children()) {
|
||||||
Node3D *child_3d{ cast_to<Node3D>(child) };
|
Node3D *child_3d{ cast_to<Node3D>(child) };
|
||||||
GETSETM(child_3d, position, {
|
GETSETM(child_3d, position, {
|
||||||
position = offset;
|
position = offset * this->run_bob_amplitude_weapon;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ private:
|
||||||
PlayerBody *body{ nullptr };
|
PlayerBody *body{ nullptr };
|
||||||
bool was_running{ false };
|
bool was_running{ false };
|
||||||
double run_bob_time{ 0.0 };
|
double run_bob_time{ 0.0 };
|
||||||
double run_bob_amplitude{ 0.025 };
|
double run_bob_amplitude_weapon{ 0.025 };
|
||||||
|
double run_bob_amplitude_camera{ 0.125 };
|
||||||
double run_bob_frequency{ 14.0 };
|
double run_bob_frequency{ 14.0 };
|
||||||
double run_bob_blend_out{ 0.2 };
|
double run_bob_blend_out{ 0.2 };
|
||||||
double weapon_lead_limit{ Math::PI * 0.0075 };
|
double weapon_lead_limit{ Math::PI * 0.0075 };
|
||||||
|
|
Loading…
Reference in a new issue