tweak: rotate animation;feat: rifle_normal map

This commit is contained in:
Sara 2024-12-02 18:39:30 +01:00
parent efc8006c66
commit e522dfb364
17 changed files with 71 additions and 20 deletions

View file

@ -54,7 +54,7 @@ void Player::process_transform_camera(double delta) {
}
void Player::process_rotate(double delta) {
if(this->fsm->get_current_node().contains("[turn]") || this->fsm->get_current_node().contains("[turn_animated]")) {
if(this->fsm->get_current_node().contains("[turn")) {
//! the signed angle difference between the left axes of the camera parent and Player
float const diff = -this->camera_parent->get_global_basis().get_column(0).signed_angle_to(this->get_global_basis().get_column(0), {0.f, 1.f, 0.f});
//! the maximum rotation to allow for this frame
@ -62,7 +62,7 @@ void Player::process_rotate(double delta) {
float const actual_speed{speed < gd::Math::abs(diff) ? gd::Math::sign(diff) * speed : diff};
// rotate by max allowed or full difference, whichever has the smaller magnitude
this->rotate_y(actual_speed);
this->anim_tree->set("parameters/TurnDirection/blend_position", diff / (this->ROTATION_SPEED * .5f));
this->anim_tree->set("parameters/TurnDirection/blend_position", diff * M_PI_2f);
this->anim_tree->set("parameters/TurnAnimation/blend_amount", this->fsm->get_current_node().contains("[turn_animated]") ? 1.f : 0.f);
} else {
this->anim_tree->set("parameters/TurnAnimation/blend_amount", 0.f);