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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:02bb57a7618cdb5a9710f81dda9d106fa65b42388ddfc54c4737d8892d80e811 oid sha256:ec386cdcbc2e0ec58510e26639006824660bdefc627b9985bbd99e7121abd01e
size 1557812 size 1894204

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3141b1abdce15138066b1863006fae0fa7ff888fc2c504a8b19e341b9f3dc645
size 335515

View file

@ -0,0 +1,38 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://uml6arceudcw"
path.s3tc="res://.godot/imported/character_rifle_normal.png-e117ec8ee646c93ddc752f3341090218.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "125780422df01dc9771b3f117027b5bb"
}
[deps]
source_file="res://models/character_rifle_normal.png"
dest_files=["res://.godot/imported/character_rifle_normal.png-e117ec8ee646c93ddc752f3341090218.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://models/character_rifle_normal.png"
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -1,6 +1,7 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dibu06h02xpdh"] [gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://dibu06h02xpdh"]
[ext_resource type="Texture2D" uid="uid://b2y2j72db80od" path="res://models/character_rifle.png" id="1_iex1v"] [ext_resource type="Texture2D" uid="uid://b2y2j72db80od" path="res://models/character_rifle.png" id="1_iex1v"]
[ext_resource type="Texture2D" uid="uid://uml6arceudcw" path="res://models/character_rifle_normal.png" id="2_061h0"]
[resource] [resource]
resource_name = "Material" resource_name = "Material"
@ -8,3 +9,6 @@ cull_mode = 2
specular_mode = 1 specular_mode = 1
albedo_texture = ExtResource("1_iex1v") albedo_texture = ExtResource("1_iex1v")
metallic = 0.293814 metallic = 0.293814
normal_enabled = true
normal_scale = 0.25
normal_texture = ExtResource("2_061h0")

View file

@ -46,7 +46,7 @@ advance_mode = 2
advance_expression = "get_input_directions().y > 0.5" advance_expression = "get_input_directions().y > 0.5"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mf4y3"] [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mf4y3"]
xfade_time = 0.2 xfade_time = 0.6
priority = 2 priority = 2
advance_mode = 2 advance_mode = 2
advance_expression = "get_input_directions().y <= 0.5" advance_expression = "get_input_directions().y <= 0.5"
@ -90,23 +90,23 @@ advance_expression = "get_input_directions().y < -0.5"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_7smdg"] [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_7smdg"]
"states/Aim Down [aim]/node" = SubResource("AnimationNodeAnimation_ukhqm") "states/Aim Down [aim]/node" = SubResource("AnimationNodeAnimation_ukhqm")
"states/Aim Down [aim]/position" = Vector2(537, 197.5) "states/Aim Down [aim]/position" = Vector2(583.446, 263.781)
"states/Aim [aim] [turn]/node" = SubResource("AnimationNodeAnimation_nhlru") "states/Aim [aim] [turn]/node" = SubResource("AnimationNodeAnimation_nhlru")
"states/Aim [aim] [turn]/position" = Vector2(537, 98) "states/Aim [aim] [turn]/position" = Vector2(583.364, 97.9174)
states/End/position = Vector2(204, 197.5) states/End/position = Vector2(204, 197.5)
"states/Fire [aim]/node" = SubResource("AnimationNodeAnimation_8rbkq") "states/Fire [aim]/node" = SubResource("AnimationNodeAnimation_8rbkq")
"states/Fire [aim]/position" = Vector2(752.5, 98) "states/Fire [aim]/position" = Vector2(798.864, 97.9174)
"states/Idle [turn_animated]/node" = SubResource("AnimationNodeAnimation_dqnnp") "states/Idle [turn_animated]/node" = SubResource("AnimationNodeAnimation_dqnnp")
"states/Idle [turn_animated]/position" = Vector2(338, 100) "states/Idle [turn_animated]/position" = Vector2(384.364, 99.9174)
states/Start/position = Vector2(204, 100) states/Start/position = Vector2(204, 100)
"states/Walk [turn]/node" = SubResource("AnimationNodeBlendTree_2mbyh") "states/Walk [turn]/node" = SubResource("AnimationNodeBlendTree_2mbyh")
"states/Walk [turn]/position" = Vector2(338, 197.5) "states/Walk [turn]/position" = Vector2(384.446, 263.781)
transitions = ["Idle [turn_animated]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_3mk5o"), "Walk [turn]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_mf4y3"), "Idle [turn_animated]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_c81tj"), "Start", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_r26s5"), "Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_4im1q"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos")] transitions = ["Idle [turn_animated]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_3mk5o"), "Walk [turn]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_mf4y3"), "Idle [turn_animated]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_c81tj"), "Start", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_r26s5"), "Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_4im1q"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos")]
graph_offset = Vector2(-351.759, -7) graph_offset = Vector2(-151.601, -33.5439)
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cwpxw"] [sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cwpxw"]
filter_enabled = true filter_enabled = true
filters = ["Character/Skeleton3D:Foot.L", "Character/Skeleton3D:Foot.R", "Character/Skeleton3D:IKTarget.Foot.L", "Character/Skeleton3D:IKTarget.Foot.R", "Character/Skeleton3D:PoleTarget.Foot.L", "Character/Skeleton3D:PoleTarget.Foot.R", "Character/Skeleton3D:hip", "Character/Skeleton3D:lowerleg.L", "Character/Skeleton3D:lowerleg.R", "Character/Skeleton3D:spine.001", "Character/Skeleton3D:upperleg.L", "Character/Skeleton3D:upperleg.R"] filters = ["Character/Skeleton3D:Foot.L", "Character/Skeleton3D:Foot.R", "Character/Skeleton3D:IKTarget.Foot.L", "Character/Skeleton3D:IKTarget.Foot.R", "Character/Skeleton3D:Neck", "Character/Skeleton3D:PoleTarget.Foot.L", "Character/Skeleton3D:PoleTarget.Foot.R", "Character/Skeleton3D:hip", "Character/Skeleton3D:lowerleg.L", "Character/Skeleton3D:lowerleg.R", "Character/Skeleton3D:spine.001", "Character/Skeleton3D:spine.002", "Character/Skeleton3D:spine.003", "Character/Skeleton3D:upperleg.L", "Character/Skeleton3D:upperleg.R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ltmcj"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ltmcj"]
animation = &"Turn_left" animation = &"Turn_left"
@ -126,7 +126,7 @@ blend_point_2/node = SubResource("AnimationNodeAnimation_dgkx8")
blend_point_2/pos = 0.0 blend_point_2/pos = 0.0
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_hiswf"] [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_hiswf"]
graph_offset = Vector2(-203, -3.5) graph_offset = Vector2(-380, 0)
nodes/Actions/node = SubResource("AnimationNodeStateMachine_7smdg") nodes/Actions/node = SubResource("AnimationNodeStateMachine_7smdg")
nodes/Actions/position = Vector2(-80, 140) nodes/Actions/position = Vector2(-80, 140)
nodes/TurnAnimation/node = SubResource("AnimationNodeBlend2_cwpxw") nodes/TurnAnimation/node = SubResource("AnimationNodeBlend2_cwpxw")
@ -262,7 +262,7 @@ unique_name_in_owner = true
top_level = true top_level = true
[node name="Camera" type="Camera3D" parent="CameraParent"] [node name="Camera" type="Camera3D" parent="CameraParent"]
transform = Transform3D(-0.99874, 0.00857726, -0.0494361, -1.83936e-08, 0.98528, 0.170948, 0.0501747, 0.170733, -0.984039, -0.510957, 1.68471, -1.00759) transform = Transform3D(-0.99874, 0.00680423, -0.0497112, -1.86265e-08, 0.990762, 0.135611, 0.0501747, 0.13544, -0.989514, -0.510957, 1.68471, -1.00759)
fov = 42.5804 fov = 42.5804
far = 100.0 far = 100.0

View file

@ -20,7 +20,7 @@ config/icon="res://icon.svg"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/size/mode=4 window/size/mode=3
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="keep_width" window/stretch/aspect="keep_width"

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3cbe2b511344382a9e2fdd63f3b066b54e181bfdf7c38543263bcfa227b12055 oid sha256:3142bfa44ccacb5cf3ef92199da6ae0cd4ffbb140f15ed121803e3bcfdcd1412
size 2501008 size 2516476

Binary file not shown.

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b0e11236244f62d387e703ee30887d3ba9076fd9b6b80f76d6a18086e1116a36 oid sha256:de194a0de12e3a8f32ca279748712647ac27f59abe03ff83af2b9773c2199666
size 2256428 size 2865292

Binary file not shown.

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6666969c801eec4b9c70459a60b3e6c2dd9745708fb2b9ccafb5a261fcfd9c85
size 219178

View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3141b1abdce15138066b1863006fae0fa7ff888fc2c504a8b19e341b9f3dc645
size 335515

View file

@ -54,7 +54,7 @@ void Player::process_transform_camera(double delta) {
} }
void Player::process_rotate(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 //! 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}); 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 //! 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}; 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 // rotate by max allowed or full difference, whichever has the smaller magnitude
this->rotate_y(actual_speed); 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); this->anim_tree->set("parameters/TurnAnimation/blend_amount", this->fsm->get_current_node().contains("[turn_animated]") ? 1.f : 0.f);
} else { } else {
this->anim_tree->set("parameters/TurnAnimation/blend_amount", 0.f); this->anim_tree->set("parameters/TurnAnimation/blend_amount", 0.f);