ended gun clipping forever
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -450,6 +450,7 @@ audio_reload = NodePath("Audio/Reload")
|
|||||||
|
|
||||||
[node name="gun" parent="." index="0"]
|
[node name="gun" parent="." index="0"]
|
||||||
transform = Transform3D(-1.81e-06, 0, -0.5, 0, 0.5, 0, 0.5, 0, -1.81e-06, 0, -0.000397999, -0.11995)
|
transform = Transform3D(-1.81e-06, 0, -0.5, 0, 0.5, 0, 0.5, 0, -1.81e-06, 0, -0.000397999, -0.11995)
|
||||||
|
cast_shadow = 0
|
||||||
|
|
||||||
[node name="mag" parent="gun" index="0"]
|
[node name="mag" parent="gun" index="0"]
|
||||||
transform = Transform3D(0.0897307, -0.048904, -9.31323e-10, 0.012226, 0.358923, 1.74623e-10, 3.72529e-09, -1.86265e-09, 0.0323253, 0.00225297, 0.0306008, -2.98023e-08)
|
transform = Transform3D(0.0897307, -0.048904, -9.31323e-10, 0.012226, 0.358923, 1.74623e-10, 3.72529e-09, -1.86265e-09, 0.0323253, 0.00225297, 0.0306008, -2.98023e-08)
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ script = ExtResource("3_405jc")
|
|||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="Head/Recoil"]
|
[node name="Camera3D" type="Camera3D" parent="Head/Recoil"]
|
||||||
transform = Transform3D(1, -8.30784e-09, 2.09548e-09, 7.50333e-12, 1, -6.0536e-09, 0, 0, 1, 1.29921e-05, -0.0445602, -0.00379455)
|
transform = Transform3D(1, -8.30784e-09, 2.09548e-09, 7.50333e-12, 1, -6.0536e-09, 0, 0, 1, 1.29921e-05, -0.0445602, -0.00379455)
|
||||||
|
cull_mask = 1048573
|
||||||
current = true
|
current = true
|
||||||
|
|
||||||
[node name="WeaponHolder" type="Node3D" parent="Head/Recoil/Camera3D"]
|
[node name="WeaponHolder" type="Node3D" parent="Head/Recoil/Camera3D"]
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
45
assets/viewmodel_shader.gdshader
Normal file
45
assets/viewmodel_shader.gdshader
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
shader_type spatial;
|
||||||
|
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
|
||||||
|
|
||||||
|
uniform float viewmodel_fov = 90.0f;
|
||||||
|
|
||||||
|
uniform vec4 albedo : source_color = vec4(1.0f);
|
||||||
|
uniform sampler2D texture_albedo : source_color;
|
||||||
|
uniform float specular = 0.5f;
|
||||||
|
uniform float metallic = 1.0f;
|
||||||
|
uniform float roughness : hint_range(0,1) = 1.0f;
|
||||||
|
uniform sampler2D texture_metallic : hint_default_white;
|
||||||
|
uniform vec4 metallic_texture_channel = vec4(1.0, 0.0, 0.0, 0.0);
|
||||||
|
uniform sampler2D texture_roughness : hint_default_white;
|
||||||
|
uniform vec4 roughness_texture_channel = vec4(1.0, 0.0, 0.0, 0.0);
|
||||||
|
uniform sampler2D texture_normal : hint_normal;
|
||||||
|
uniform float normal_scale : hint_range(-16,16) = 0.5f;
|
||||||
|
uniform vec3 uv1_scale = vec3(1.0f);
|
||||||
|
uniform vec3 uv1_offset = vec3(0.0f);
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
UV = UV * uv1_scale.xy + uv1_offset.xy;
|
||||||
|
/* begin shader magic*/
|
||||||
|
float onetanfov = 1.0f / tan(0.5f * (viewmodel_fov * PI / 180.0f));
|
||||||
|
float aspect = VIEWPORT_SIZE.x / VIEWPORT_SIZE.y;
|
||||||
|
// modify projection matrix
|
||||||
|
PROJECTION_MATRIX[1][1] = -onetanfov;
|
||||||
|
PROJECTION_MATRIX[0][0] = onetanfov / aspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
DEPTH = FRAGCOORD.z * 2.99;
|
||||||
|
vec2 base_uv = UV;
|
||||||
|
vec4 albedo_tex = texture(texture_albedo,base_uv);
|
||||||
|
albedo_tex *= COLOR;
|
||||||
|
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
||||||
|
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
|
||||||
|
METALLIC = metallic_tex * metallic;
|
||||||
|
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
|
||||||
|
ROUGHNESS = roughness_tex * roughness;
|
||||||
|
SPECULAR = specular;
|
||||||
|
NORMAL_MAP = texture(texture_normal,base_uv).rgb;
|
||||||
|
|
||||||
|
NORMAL_MAP_DEPTH = normal_scale;
|
||||||
|
|
||||||
|
}
|
||||||
141
blunderbus.tscn
141
blunderbus.tscn
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="First Person Test"
|
config/name="First Person Test"
|
||||||
run/main_scene="res://scenes/blockout_4.tscn"
|
run/main_scene="res://assets/blockout_2.tscn"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
if !dead and !level_control.paused:
|
if !dead and !level_control.paused:
|
||||||
|
|
||||||
|
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
double_jump = true
|
double_jump = true
|
||||||
@@ -367,8 +368,11 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
# Gun folding out of the way
|
# Gun folding out of the way
|
||||||
if gun_ray.is_colliding():
|
if gun_ray.is_colliding():
|
||||||
weapon_holder.rotation = lerp(weapon_holder.rotation, Vector3(2, -1, -1), delta * 7)
|
var distance_to_wall = 1 - (gun_ray.global_position.distance_to(gun_ray.get_collision_point()) / abs(gun_ray.target_position.z))
|
||||||
weapon_holder.position = lerp(weapon_holder.position, Vector3(-.02,-.1,.06),(delta * 7))
|
var rotation_target = lerp(weapon_holder.rotation, Vector3(2, -1, -1), distance_to_wall)
|
||||||
|
var position_target = lerp(weapon_holder.position, Vector3(-.02,-.1,.06),distance_to_wall)
|
||||||
|
weapon_holder.rotation = lerp(weapon_holder.rotation, rotation_target, delta * 7)
|
||||||
|
weapon_holder.position = lerp(weapon_holder.position, position_target, delta * 7)
|
||||||
gun_folded = true
|
gun_folded = true
|
||||||
elif !gun_ray.is_colliding():
|
elif !gun_ray.is_colliding():
|
||||||
weapon_holder.rotation = lerp(weapon_holder.rotation, weapon_holder_start_rot,delta*7)
|
weapon_holder.rotation = lerp(weapon_holder.rotation, weapon_holder_start_rot,delta*7)
|
||||||
@@ -526,7 +530,6 @@ func ladder_collide():
|
|||||||
else:
|
else:
|
||||||
gravity = default_gravity
|
gravity = default_gravity
|
||||||
|
|
||||||
|
|
||||||
## VARIOUS ACTIONS
|
## VARIOUS ACTIONS
|
||||||
func flashlight_toggle():
|
func flashlight_toggle():
|
||||||
if flashlight_on:
|
if flashlight_on:
|
||||||
@@ -540,9 +543,9 @@ func aim_down_sights(delta):
|
|||||||
if gun.ads == true:
|
if gun.ads == true:
|
||||||
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
||||||
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
|
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
|
||||||
else:
|
else:
|
||||||
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
|
gun.position = lerp(gun.position, weapon_start_pos,delta * 2)
|
||||||
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
|
||||||
|
|
||||||
func grab_moveable(body):
|
func grab_moveable(body):
|
||||||
holster_gun(true)
|
holster_gun(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user