fix: separated run and weapon bob amplitude
This commit is contained in:
parent
e30758754c
commit
f646f70c37
2 changed files with 5 additions and 4 deletions
|
|
@ -40,19 +40,19 @@ void PlayerCamera::update_offset() {
|
|||
this->run_bob_time = 0.0;
|
||||
}
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
GETSET(position, {
|
||||
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()) {
|
||||
Node3D *child_3d{ cast_to<Node3D>(child) };
|
||||
GETSETM(child_3d, position, {
|
||||
position = offset;
|
||||
position = offset * this->run_bob_amplitude_weapon;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue