Feat/11 adding better fundamental weapon models and some textures #16
@@ -0,0 +1,11 @@
|
||||
Model Information:
|
||||
* title: Low-Poly AK-74
|
||||
* source: https://sketchfab.com/3d-models/low-poly-ak-74-b27f9003622a4c7499bfd8d2a06dc47b
|
||||
* author: TastyTony (https://sketchfab.com/TastyTony)
|
||||
|
||||
Model License:
|
||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
* requirements: Author must be credited. Commercial use is allowed.
|
||||
|
||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
||||
This work is based on "Low-Poly AK-74" (https://sketchfab.com/3d-models/low-poly-ak-74-b27f9003622a4c7499bfd8d2a06dc47b) by TastyTony (https://sketchfab.com/TastyTony) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
|
After Width: | Height: | Size: 802 B |
|
After Width: | Height: | Size: 556 B |
@@ -0,0 +1,11 @@
|
||||
Model Information:
|
||||
* title: Modular Shotgun
|
||||
* source: https://sketchfab.com/3d-models/modular-shotgun-5c04438b213648ea83007858e2b8c162
|
||||
* author: Somersby (https://sketchfab.com/Somersby)
|
||||
|
||||
Model License:
|
||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
* requirements: Author must be credited. Commercial use is allowed.
|
||||
|
||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
||||
This work is based on "Modular Shotgun" (https://sketchfab.com/3d-models/modular-shotgun-5c04438b213648ea83007858e2b8c162) by Somersby (https://sketchfab.com/Somersby) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
|
After Width: | Height: | Size: 4.8 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 5.3 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 182 KiB |
|
After Width: | Height: | Size: 544 KiB |
|
After Width: | Height: | Size: 268 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 591 KiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
@@ -20,8 +20,8 @@ func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
camera = get_node_or_null("Camera3D")
|
||||
if camera and params:
|
||||
camera.fov = params.base_fov
|
||||
_target_fov = params.base_fov
|
||||
camera.fov = SettingsManager.world_fov
|
||||
_target_fov = SettingsManager.world_fov
|
||||
# Explicitly enable callbacks — set_script() at runtime doesn't auto-register them
|
||||
set_process_input(true)
|
||||
set_process(true)
|
||||
@@ -29,7 +29,7 @@ func _ready() -> void:
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
var is_ads = camera and camera.fov < params.base_fov - 5.0
|
||||
var is_ads = camera and camera.fov < SettingsManager.world_fov - 5.0
|
||||
var sens = SettingsManager.ads_sensitivity if is_ads else SettingsManager.mouse_sensitivity
|
||||
# Yaw: rotate the player (parent)
|
||||
get_parent().rotate_y(-event.relative.x * sens)
|
||||
@@ -53,12 +53,12 @@ func _process(delta: float) -> void:
|
||||
return
|
||||
|
||||
# ── FOV kick ──────────────────────────────────────────────────────────
|
||||
_target_fov = params.base_fov
|
||||
_target_fov = SettingsManager.world_fov
|
||||
var hspeed := Vector2(player.velocity.x, player.velocity.z).length()
|
||||
|
||||
# Smoothly scale FOV based on speed above walking speed
|
||||
var speed_factor = clampf((hspeed - params.walk_speed) / (params.walk_speed * 0.5), 0.0, 1.0)
|
||||
_target_fov = lerpf(params.base_fov, params.dash_fov, speed_factor)
|
||||
_target_fov = lerpf(SettingsManager.world_fov, SettingsManager.world_fov + 20.0, speed_factor)
|
||||
|
||||
if _weapon_fov_override > 0.0:
|
||||
_target_fov = _weapon_fov_override
|
||||
|
||||
@@ -29,6 +29,7 @@ var show_debug_ui: bool = false
|
||||
var username: String = "Player"
|
||||
var mouse_sensitivity: float = 0.002
|
||||
var ads_sensitivity: float = 0.001
|
||||
var world_fov: float = 90.0
|
||||
|
||||
# Video Settings
|
||||
var display_mode: int = DisplayServer.WINDOW_MODE_WINDOWED
|
||||
@@ -135,6 +136,7 @@ func _save_settings() -> void:
|
||||
"username": username,
|
||||
"mouse_sensitivity": mouse_sensitivity,
|
||||
"ads_sensitivity": ads_sensitivity,
|
||||
"world_fov": world_fov,
|
||||
"display_mode": display_mode,
|
||||
"resolution_index": resolution_index,
|
||||
"fps_cap": fps_cap,
|
||||
@@ -171,6 +173,7 @@ func _load_settings() -> void:
|
||||
if data.has("show_debug_ui"): show_debug_ui = data["show_debug_ui"]
|
||||
if data.has("mouse_sensitivity"): mouse_sensitivity = data["mouse_sensitivity"]
|
||||
if data.has("ads_sensitivity"): ads_sensitivity = data["ads_sensitivity"]
|
||||
if data.has("world_fov"): world_fov = data["world_fov"]
|
||||
if data.has("display_mode"): display_mode = data["display_mode"]
|
||||
if data.has("resolution_index"): resolution_index = data["resolution_index"]
|
||||
if data.has("fps_cap"): fps_cap = data["fps_cap"]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://bsgjg5nrt43vu
|
||||
@@ -25,6 +25,8 @@ var editing_index: int = -1
|
||||
# Settings UI
|
||||
var settings_editor: Control
|
||||
var settings_back_btn: Button
|
||||
var _world_fov_slider: HSlider
|
||||
var _world_fov_input: LineEdit
|
||||
var _debug_ui_checkbox: CheckButton
|
||||
var _mouse_sens_slider: HSlider
|
||||
var _mouse_sens_input: LineEdit
|
||||
@@ -279,6 +281,43 @@ func _build_ui() -> void:
|
||||
)
|
||||
user_hbox.add_child(user_save)
|
||||
|
||||
var fov_hbox = HBoxContainer.new()
|
||||
general_tab.add_child(fov_hbox)
|
||||
|
||||
var fov_lbl = Label.new()
|
||||
fov_lbl.text = "World FOV"
|
||||
fov_lbl.custom_minimum_size = Vector2(150, 0)
|
||||
fov_hbox.add_child(fov_lbl)
|
||||
|
||||
_world_fov_slider = HSlider.new()
|
||||
_world_fov_slider.min_value = 70.0
|
||||
_world_fov_slider.max_value = 120.0
|
||||
_world_fov_slider.step = 1.0
|
||||
_world_fov_slider.value = SettingsManager.world_fov
|
||||
_world_fov_slider.custom_minimum_size = Vector2(200, 0)
|
||||
_world_fov_slider.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||||
fov_hbox.add_child(_world_fov_slider)
|
||||
|
||||
_world_fov_input = LineEdit.new()
|
||||
_world_fov_input.text = str(round(SettingsManager.world_fov))
|
||||
_world_fov_input.custom_minimum_size = Vector2(60, 0)
|
||||
fov_hbox.add_child(_world_fov_input)
|
||||
|
||||
_world_fov_slider.value_changed.connect(func(value: float):
|
||||
_world_fov_input.text = str(round(value))
|
||||
SettingsManager.world_fov = value
|
||||
SettingsManager._save_settings()
|
||||
)
|
||||
|
||||
_world_fov_input.text_submitted.connect(func(new_text: String):
|
||||
var val = new_text.to_float()
|
||||
val = clampf(val, 70.0, 120.0)
|
||||
_world_fov_slider.value = val
|
||||
_world_fov_input.text = str(round(val))
|
||||
SettingsManager.world_fov = val
|
||||
SettingsManager._save_settings()
|
||||
)
|
||||
|
||||
var spacer_gen = Control.new()
|
||||
spacer_gen.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
general_tab.add_child(spacer_gen)
|
||||
@@ -286,7 +325,9 @@ func _build_ui() -> void:
|
||||
var reset_gen_btn = Button.new()
|
||||
reset_gen_btn.text = "Reset to Defaults"
|
||||
reset_gen_btn.pressed.connect(func():
|
||||
pass # No settings yet
|
||||
_world_fov_slider.value = 90.0
|
||||
SettingsManager.world_fov = 90.0
|
||||
SettingsManager._save_settings()
|
||||
)
|
||||
general_tab.add_child(reset_gen_btn)
|
||||
|
||||
@@ -743,6 +784,9 @@ func _show_settings() -> void:
|
||||
_debug_ui_checkbox.button_pressed = SettingsManager.show_debug_ui
|
||||
if _show_fps_checkbox:
|
||||
_show_fps_checkbox.button_pressed = SettingsManager.show_fps
|
||||
if _world_fov_slider:
|
||||
_world_fov_slider.value = SettingsManager.world_fov
|
||||
_world_fov_input.text = str(round(SettingsManager.world_fov))
|
||||
if _mouse_sens_slider:
|
||||
var display_val = round(SettingsManager.mouse_sensitivity * 10000.0)
|
||||
_mouse_sens_slider.value = display_val
|
||||
|
||||
@@ -14,52 +14,16 @@ func _init() -> void:
|
||||
spread_angle = 0.015
|
||||
|
||||
func _build_model() -> void:
|
||||
# Position
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
# Receiver
|
||||
var receiver = MeshInstance3D.new()
|
||||
var rec_mesh = BoxMesh.new()
|
||||
rec_mesh.size = Vector3(0.06, 0.12, 0.3)
|
||||
var rec_mat = StandardMaterial3D.new()
|
||||
rec_mat.albedo_color = Color(0.2, 0.2, 0.2)
|
||||
rec_mesh.material = rec_mat
|
||||
receiver.mesh = rec_mesh
|
||||
receiver.position = Vector3(0, 0, 0.1)
|
||||
model_root.add_child(receiver)
|
||||
|
||||
# Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.015
|
||||
b_mesh.bottom_radius = 0.015
|
||||
b_mesh.height = 0.45
|
||||
b_mesh.material = rec_mat
|
||||
barrel.mesh = b_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.03, -0.2)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
# Wood Handguard
|
||||
var guard = MeshInstance3D.new()
|
||||
var g_mesh = BoxMesh.new()
|
||||
g_mesh.size = Vector3(0.08, 0.08, 0.2)
|
||||
var wood_mat = StandardMaterial3D.new()
|
||||
wood_mat.albedo_color = Color(0.5, 0.25, 0.1)
|
||||
g_mesh.material = wood_mat
|
||||
guard.mesh = g_mesh
|
||||
guard.position = Vector3(0, 0, -0.1)
|
||||
model_root.add_child(guard)
|
||||
|
||||
# Wood Stock
|
||||
var stock = MeshInstance3D.new()
|
||||
var s_mesh = BoxMesh.new()
|
||||
s_mesh.size = Vector3(0.06, 0.1, 0.25)
|
||||
s_mesh.material = wood_mat
|
||||
stock.mesh = s_mesh
|
||||
stock.position = Vector3(0, -0.02, 0.35)
|
||||
model_root.add_child(stock)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.590)
|
||||
|
||||
var model_scene = load("res://assets/weapons/ak47/source/scene.gltf")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.00125, 0.00125, 0.00125)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.7, 0.2)
|
||||
|
||||
@@ -21,45 +21,16 @@ func _init() -> void:
|
||||
penetration_damage_penalty = 0.5
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.8)
|
||||
|
||||
var mat_green = StandardMaterial3D.new()
|
||||
mat_green.albedo_color = Color(0.1, 0.4, 0.1)
|
||||
var mat_black = StandardMaterial3D.new()
|
||||
mat_black.albedo_color = Color(0.1, 0.1, 0.1)
|
||||
|
||||
# Body
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.06, 0.12, 0.6)
|
||||
b_mesh.material = mat_green
|
||||
body.mesh = b_mesh
|
||||
model_root.add_child(body)
|
||||
|
||||
# Scope
|
||||
var scope = MeshInstance3D.new()
|
||||
var s_mesh = CylinderMesh.new()
|
||||
s_mesh.top_radius = 0.03
|
||||
s_mesh.bottom_radius = 0.03
|
||||
s_mesh.height = 0.25
|
||||
s_mesh.material = mat_black
|
||||
scope.mesh = s_mesh
|
||||
scope.rotation.x = deg_to_rad(90)
|
||||
scope.position = Vector3(0, 0.09, -0.1)
|
||||
model_root.add_child(scope)
|
||||
|
||||
# Long Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var bar_mesh = CylinderMesh.new()
|
||||
bar_mesh.top_radius = 0.015
|
||||
bar_mesh.bottom_radius = 0.02
|
||||
bar_mesh.height = 0.6
|
||||
bar_mesh.material = mat_black
|
||||
barrel.mesh = bar_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.04, -0.6)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.729)
|
||||
|
||||
var model_scene = load("res://assets/weapons/awp/source/L118a1.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.275, 0.275, 0.275)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Audio
|
||||
fire_sound = AudioStreamPlayer3D.new()
|
||||
fire_sound.bus = "SFX"
|
||||
@@ -85,7 +56,7 @@ func _process(delta: float) -> void:
|
||||
rig.set_weapon_fov(ads_fov if is_ads else -1.0)
|
||||
|
||||
# Move model slightly based on ADS
|
||||
var target_pos = Vector3(0.0, -0.15, -0.6) if is_ads else Vector3(0.3, -0.3, -0.8)
|
||||
var target_pos = Vector3(0.0, -0.15, -0.608) if is_ads else Vector3(0.3, -0.3, -0.729)
|
||||
position = position.lerp(target_pos, 15.0 * delta)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -110,4 +81,4 @@ func unequip() -> void:
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(-1.0)
|
||||
target_fov = default_fov
|
||||
position = Vector3(0.3, -0.3, -0.8)
|
||||
position = Vector3(0.3, -0.3, -0.729)
|
||||
|
||||
@@ -23,46 +23,16 @@ func _ready() -> void:
|
||||
default_fov = camera.fov
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.7)
|
||||
|
||||
var body_mat = StandardMaterial3D.new()
|
||||
body_mat.albedo_color = Color(0.15, 0.25, 0.15) # Olive drab
|
||||
var black_mat = StandardMaterial3D.new()
|
||||
black_mat.albedo_color = Color(0.05, 0.05, 0.05)
|
||||
|
||||
# Receiver
|
||||
var receiver = MeshInstance3D.new()
|
||||
var rec_mesh = BoxMesh.new()
|
||||
rec_mesh.size = Vector3(0.05, 0.12, 0.4)
|
||||
rec_mesh.material = body_mat
|
||||
receiver.mesh = rec_mesh
|
||||
receiver.position = Vector3(0, 0, 0.1)
|
||||
model_root.add_child(receiver)
|
||||
|
||||
# Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.01
|
||||
b_mesh.bottom_radius = 0.01
|
||||
b_mesh.height = 0.6
|
||||
b_mesh.material = black_mat
|
||||
barrel.mesh = b_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.03, -0.3)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
# Scope
|
||||
var scope = MeshInstance3D.new()
|
||||
var scope_mesh = CylinderMesh.new()
|
||||
scope_mesh.top_radius = 0.02
|
||||
scope_mesh.bottom_radius = 0.02
|
||||
scope_mesh.height = 0.2
|
||||
scope_mesh.material = black_mat
|
||||
scope.mesh = scope_mesh
|
||||
scope.rotation.x = deg_to_rad(90)
|
||||
scope.position = Vector3(0, 0.08, 0.05)
|
||||
model_root.add_child(scope)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.49)
|
||||
|
||||
var model_scene = load("res://assets/weapons/dmr/source/M14 .blend")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.1875, 0.1875, 0.1875)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.8, 0.4)
|
||||
@@ -125,4 +95,4 @@ func unequip() -> void:
|
||||
var rig = camera.get_parent()
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(-1.0)
|
||||
position = Vector3(0.3, -0.3, -0.7)
|
||||
position = Vector3(0.3, -0.3, -0.49)
|
||||
|
||||
@@ -20,46 +20,19 @@ func _ready() -> void:
|
||||
_build_model()
|
||||
|
||||
func _build_model() -> void:
|
||||
# Simple FPS weapon placement (bottom right)
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
model_root = Node3D.new()
|
||||
add_child(model_root)
|
||||
|
||||
# Stock
|
||||
var stock = MeshInstance3D.new()
|
||||
var stock_mesh = BoxMesh.new()
|
||||
stock_mesh.size = Vector3(0.1, 0.1, 0.4)
|
||||
var stock_mat = StandardMaterial3D.new()
|
||||
stock_mat.albedo_color = Color(0.4, 0.2, 0.1) # Brown wood
|
||||
stock_mesh.material = stock_mat
|
||||
stock.mesh = stock_mesh
|
||||
stock.position = Vector3(0, 0, 0.2)
|
||||
model_root.add_child(stock)
|
||||
|
||||
# Left Barrel
|
||||
var barrel_l = MeshInstance3D.new()
|
||||
var barrel_mesh = CylinderMesh.new()
|
||||
barrel_mesh.top_radius = 0.03
|
||||
barrel_mesh.bottom_radius = 0.03
|
||||
barrel_mesh.height = 0.6
|
||||
var barrel_mat = StandardMaterial3D.new()
|
||||
barrel_mat.albedo_color = Color(0.2, 0.2, 0.2) # Dark grey metal
|
||||
barrel_mat.metallic = 0.8
|
||||
barrel_mat.roughness = 0.4
|
||||
barrel_mesh.material = barrel_mat
|
||||
barrel_l.mesh = barrel_mesh
|
||||
barrel_l.rotation.x = deg_to_rad(90)
|
||||
barrel_l.position = Vector3(-0.04, 0.03, -0.1)
|
||||
model_root.add_child(barrel_l)
|
||||
|
||||
# Right Barrel
|
||||
var barrel_r = MeshInstance3D.new()
|
||||
barrel_r.mesh = barrel_mesh
|
||||
barrel_r.rotation.x = deg_to_rad(90)
|
||||
barrel_r.position = Vector3(0.04, 0.03, -0.1)
|
||||
model_root.add_child(barrel_r)
|
||||
|
||||
if not model_root:
|
||||
model_root = Node3D.new()
|
||||
add_child(model_root)
|
||||
position = Vector3(0.3, -0.3, -0.690)
|
||||
|
||||
var model_scene = load("res://assets/weapons/double barrel/source/Double Deuce.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.275, 0.275, 0.275)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash Light
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.8, 0.3)
|
||||
@@ -222,7 +195,7 @@ func _shoot_hitscan() -> void:
|
||||
|
||||
t_mesh_inst.mesh = t_mesh
|
||||
t_mesh_inst.rotation.x = deg_to_rad(90)
|
||||
t_mesh_inst.position = Vector3(0, 0, -0.5)
|
||||
t_mesh_inst.position = Vector3(0, 0, -0.719)
|
||||
tracer.add_child(t_mesh_inst)
|
||||
|
||||
tracer.target_position = final_target
|
||||
|
||||
@@ -13,7 +13,7 @@ var model_root: Node3D
|
||||
|
||||
var auto_switch_slot: int = -1
|
||||
var is_swinging: bool = false
|
||||
var default_pos: Vector3 = Vector3(0.3, -0.3, -0.6)
|
||||
var default_pos: Vector3 = Vector3(0.3, -0.3, -0.945)
|
||||
|
||||
var fire_sound: AudioStreamPlayer3D
|
||||
|
||||
@@ -26,44 +26,21 @@ func _ready() -> void:
|
||||
position = default_pos
|
||||
|
||||
func _build_model() -> void:
|
||||
var mat_handle = StandardMaterial3D.new()
|
||||
mat_handle.albedo_color = Color(0.1, 0.1, 0.1)
|
||||
|
||||
var mat_blade = StandardMaterial3D.new()
|
||||
mat_blade.albedo_color = Color(0.8, 0.8, 0.8)
|
||||
mat_blade.metallic = 0.8
|
||||
mat_blade.roughness = 0.2
|
||||
|
||||
# Handle
|
||||
var handle = MeshInstance3D.new()
|
||||
var h_mesh = CylinderMesh.new()
|
||||
h_mesh.top_radius = 0.02
|
||||
h_mesh.bottom_radius = 0.02
|
||||
h_mesh.height = 0.15
|
||||
h_mesh.material = mat_handle
|
||||
handle.mesh = h_mesh
|
||||
handle.rotation.x = deg_to_rad(90)
|
||||
handle.position = Vector3(0, 0, 0)
|
||||
model_root.add_child(handle)
|
||||
|
||||
# Blade
|
||||
var blade = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.01, 0.04, 0.25)
|
||||
b_mesh.material = mat_blade
|
||||
blade.mesh = b_mesh
|
||||
blade.position = Vector3(0, 0, -0.2)
|
||||
model_root.add_child(blade)
|
||||
|
||||
# Guard
|
||||
var guard = MeshInstance3D.new()
|
||||
var g_mesh = BoxMesh.new()
|
||||
g_mesh.size = Vector3(0.06, 0.05, 0.01)
|
||||
g_mesh.material = mat_handle
|
||||
guard.mesh = g_mesh
|
||||
guard.position = Vector3(0, 0, -0.075)
|
||||
model_root.add_child(guard)
|
||||
|
||||
var model_scene = load("res://assets/weapons/knife/source/Knife.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.125, 0.125, 0.125)
|
||||
model.rotation_degrees.y = 270
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_texture = load("res://assets/weapons/knife/textures/Color Palette.png")
|
||||
|
||||
for child in model.find_children("*", "MeshInstance3D", true, false):
|
||||
child.set_surface_override_material(0, mat)
|
||||
|
||||
# Audio (reusing shotgun reload or something generic for now, ideally a swish)
|
||||
fire_sound = AudioStreamPlayer3D.new()
|
||||
fire_sound.bus = "SFX"
|
||||
@@ -106,11 +83,11 @@ func _swing() -> void:
|
||||
var tween = create_tween()
|
||||
|
||||
# Windup: Move to the right, point the blade left and tilt it
|
||||
tween.tween_property(self, "position", Vector3(0.6, -0.2, -0.4), 0.1)
|
||||
tween.tween_property(self, "position", Vector3(0.6, -0.2, -0.630), 0.1)
|
||||
tween.parallel().tween_property(self, "rotation", Vector3(deg_to_rad(10), deg_to_rad(80), deg_to_rad(-40)), 0.1)
|
||||
|
||||
# Swipe: Move across the screen to the left quickly
|
||||
tween.tween_property(self, "position", Vector3(-0.6, -0.3, -0.5), 0.1)
|
||||
tween.tween_property(self, "position", Vector3(-0.6, -0.3, -0.788), 0.1)
|
||||
tween.parallel().tween_property(self, "rotation", Vector3(deg_to_rad(10), deg_to_rad(110), deg_to_rad(-60)), 0.1)
|
||||
|
||||
# Return to idle
|
||||
|
||||
@@ -14,43 +14,16 @@ func _init() -> void:
|
||||
spread_angle = 0.01
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
var grey_mat = StandardMaterial3D.new()
|
||||
grey_mat.albedo_color = Color(0.25, 0.25, 0.25)
|
||||
var dark_mat = StandardMaterial3D.new()
|
||||
dark_mat.albedo_color = Color(0.1, 0.1, 0.1)
|
||||
|
||||
# Receiver
|
||||
var receiver = MeshInstance3D.new()
|
||||
var rec_mesh = BoxMesh.new()
|
||||
rec_mesh.size = Vector3(0.05, 0.14, 0.25)
|
||||
rec_mesh.material = grey_mat
|
||||
receiver.mesh = rec_mesh
|
||||
receiver.position = Vector3(0, 0, 0.1)
|
||||
model_root.add_child(receiver)
|
||||
|
||||
# Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.012
|
||||
b_mesh.bottom_radius = 0.012
|
||||
b_mesh.height = 0.4
|
||||
b_mesh.material = dark_mat
|
||||
barrel.mesh = b_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.04, -0.2)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
# Handguard
|
||||
var guard = MeshInstance3D.new()
|
||||
var g_mesh = BoxMesh.new()
|
||||
g_mesh.size = Vector3(0.06, 0.07, 0.22)
|
||||
g_mesh.material = dark_mat
|
||||
guard.mesh = g_mesh
|
||||
guard.position = Vector3(0, 0.04, -0.1)
|
||||
model_root.add_child(guard)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.656)
|
||||
|
||||
var model_scene = load("res://assets/weapons/m4/source/M4a4.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.275, 0.275, 0.275)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.8, 0.4)
|
||||
|
||||
@@ -17,22 +17,22 @@ func _init() -> void:
|
||||
projectile_gravity = 15.0 # Heavy drop
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.4, -0.5)
|
||||
|
||||
var mat_olive = StandardMaterial3D.new()
|
||||
mat_olive.albedo_color = Color(0.2, 0.3, 0.1)
|
||||
|
||||
# Thick short tube
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.12
|
||||
b_mesh.bottom_radius = 0.12
|
||||
b_mesh.height = 0.5
|
||||
b_mesh.material = mat_olive
|
||||
body.mesh = b_mesh
|
||||
body.rotation.x = deg_to_rad(90)
|
||||
model_root.add_child(body)
|
||||
|
||||
position = Vector3(0.5, -0.4, -0.8)
|
||||
|
||||
var model_scene = load("res://assets/weapons/mortar/source/scene.gltf")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.0025, 0.0025, 0.0025)
|
||||
model.rotation_degrees.y = -90
|
||||
model.position.y -= 0.2
|
||||
|
||||
# Aggressively strip any rogue nodes from the GLTF that could ruin the scene
|
||||
for node in model.find_children("*", "", true, false):
|
||||
if node is Light3D or node is Camera3D or node is WorldEnvironment or node is ReflectionProbe:
|
||||
if node is Node3D: node.visible = false
|
||||
node.queue_free()
|
||||
|
||||
# Audio
|
||||
fire_sound = AudioStreamPlayer3D.new()
|
||||
fire_sound.bus = "SFX"
|
||||
|
||||
@@ -14,52 +14,16 @@ func _init() -> void:
|
||||
spread_angle = 0.025
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.25, -0.25, -0.5)
|
||||
|
||||
var black_mat = StandardMaterial3D.new()
|
||||
black_mat.albedo_color = Color(0.05, 0.05, 0.05)
|
||||
|
||||
# Receiver
|
||||
var receiver = MeshInstance3D.new()
|
||||
var rec_mesh = BoxMesh.new()
|
||||
rec_mesh.size = Vector3(0.04, 0.1, 0.2)
|
||||
rec_mesh.material = black_mat
|
||||
receiver.mesh = rec_mesh
|
||||
receiver.position = Vector3(0, 0, 0)
|
||||
model_root.add_child(receiver)
|
||||
|
||||
# Grip
|
||||
var grip = MeshInstance3D.new()
|
||||
var g_mesh = BoxMesh.new()
|
||||
g_mesh.size = Vector3(0.03, 0.12, 0.04)
|
||||
g_mesh.material = black_mat
|
||||
grip.mesh = g_mesh
|
||||
grip.position = Vector3(0, -0.06, 0.08)
|
||||
grip.rotation.x = deg_to_rad(10)
|
||||
model_root.add_child(grip)
|
||||
|
||||
# Foregrip
|
||||
var fgrip = MeshInstance3D.new()
|
||||
var fg_mesh = BoxMesh.new()
|
||||
fg_mesh.size = Vector3(0.03, 0.08, 0.03)
|
||||
fg_mesh.material = black_mat
|
||||
fgrip.mesh = fg_mesh
|
||||
fgrip.position = Vector3(0, -0.05, -0.06)
|
||||
fgrip.rotation.x = deg_to_rad(-10)
|
||||
model_root.add_child(fgrip)
|
||||
|
||||
# Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.008
|
||||
b_mesh.bottom_radius = 0.008
|
||||
b_mesh.height = 0.1
|
||||
b_mesh.material = black_mat
|
||||
barrel.mesh = b_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.02, -0.15)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
position = Vector3(0.25, -0.25, -0.35)
|
||||
|
||||
var model_scene = load("res://assets/weapons/mp7/source/HK MP7.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.08, 0.08, 0.08)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.9, 0.5)
|
||||
|
||||
@@ -16,55 +16,30 @@ func _init() -> void:
|
||||
projectile_gravity = 5.0 # Slight drop
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
var yellow_mat = StandardMaterial3D.new()
|
||||
yellow_mat.albedo_color = Color(0.8, 0.7, 0.1) # Construction yellow
|
||||
var dark_mat = StandardMaterial3D.new()
|
||||
dark_mat.albedo_color = Color(0.2, 0.2, 0.2)
|
||||
|
||||
# Body
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.06, 0.16, 0.25)
|
||||
b_mesh.material = yellow_mat
|
||||
body.mesh = b_mesh
|
||||
body.position = Vector3(0, 0.02, 0)
|
||||
model_root.add_child(body)
|
||||
|
||||
# Handle
|
||||
var handle = MeshInstance3D.new()
|
||||
var h_mesh = BoxMesh.new()
|
||||
h_mesh.size = Vector3(0.04, 0.1, 0.04)
|
||||
h_mesh.material = dark_mat
|
||||
handle.mesh = h_mesh
|
||||
handle.position = Vector3(0, -0.1, 0.05)
|
||||
model_root.add_child(handle)
|
||||
|
||||
# Mag (Nail Drum)
|
||||
var drum = MeshInstance3D.new()
|
||||
var d_mesh = CylinderMesh.new()
|
||||
d_mesh.top_radius = 0.05
|
||||
d_mesh.bottom_radius = 0.05
|
||||
d_mesh.height = 0.1
|
||||
d_mesh.material = dark_mat
|
||||
drum.mesh = d_mesh
|
||||
drum.rotation.z = deg_to_rad(90)
|
||||
drum.position = Vector3(0, -0.06, -0.05)
|
||||
model_root.add_child(drum)
|
||||
|
||||
# Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var bar_mesh = CylinderMesh.new()
|
||||
bar_mesh.top_radius = 0.01
|
||||
bar_mesh.bottom_radius = 0.01
|
||||
bar_mesh.height = 0.15
|
||||
bar_mesh.material = dark_mat
|
||||
barrel.mesh = bar_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.05, -0.2)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.604)
|
||||
|
||||
var model_scene = load("res://assets/weapons/nailgun/source/Sopra.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.06, 0.06, 0.06)
|
||||
model.rotation_degrees.y = 180
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_texture = load("res://assets/weapons/nailgun/textures/Base_texture.png")
|
||||
mat.normal_enabled = true
|
||||
mat.normal_texture = load("res://assets/weapons/nailgun/textures/Normal_texture.png")
|
||||
mat.metallic = 1.0
|
||||
mat.metallic_texture = load("res://assets/weapons/nailgun/textures/Metallic_texture.png")
|
||||
mat.roughness_texture = load("res://assets/weapons/nailgun/textures/Roughness_texture.png")
|
||||
mat.ao_enabled = true
|
||||
mat.ao_texture = load("res://assets/weapons/nailgun/textures/internal_ground_ao_texture.jpeg")
|
||||
|
||||
for child in model.find_children("*", "MeshInstance3D", true, false):
|
||||
child.set_surface_override_material(0, mat)
|
||||
|
||||
# Muzzle Flash (Sparks)
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.9, 0.6)
|
||||
|
||||
@@ -17,37 +17,23 @@ func _init() -> void:
|
||||
projectile_gravity = 0.0
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
var white_mat = StandardMaterial3D.new()
|
||||
white_mat.albedo_color = Color(0.8, 0.8, 0.9)
|
||||
var glow_mat = StandardMaterial3D.new()
|
||||
glow_mat.albedo_color = Color(0.2, 0.5, 1.0)
|
||||
glow_mat.emission_enabled = true
|
||||
glow_mat.emission = Color(0.2, 0.5, 1.0)
|
||||
glow_mat.emission_energy_multiplier = 4.0
|
||||
|
||||
# Body
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.08, 0.14, 0.35)
|
||||
b_mesh.material = white_mat
|
||||
body.mesh = b_mesh
|
||||
body.position = Vector3(0, 0, 0.05)
|
||||
model_root.add_child(body)
|
||||
|
||||
# Glow Core
|
||||
var core = MeshInstance3D.new()
|
||||
var c_mesh = CylinderMesh.new()
|
||||
c_mesh.top_radius = 0.02
|
||||
c_mesh.bottom_radius = 0.02
|
||||
c_mesh.height = 0.4
|
||||
c_mesh.material = glow_mat
|
||||
core.mesh = c_mesh
|
||||
core.rotation.x = deg_to_rad(90)
|
||||
core.position = Vector3(0, 0.02, -0.15)
|
||||
model_root.add_child(core)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.656)
|
||||
|
||||
var model_scene = load("res://assets/weapons/plasmagun/source/Plasma rifle.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(1.0, 1.0, 1.0)
|
||||
model.rotation_degrees.y = 180
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_texture = load("res://assets/weapons/plasmagun/textures/Plasma_rifle.png")
|
||||
|
||||
for child in model.find_children("*", "MeshInstance3D", true, false):
|
||||
child.set_surface_override_material(0, mat)
|
||||
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(0.2, 0.5, 1.0)
|
||||
|
||||
@@ -17,34 +17,16 @@ func _init() -> void:
|
||||
projectile_gravity = 0.0 # Flies straight
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.4, -0.4, -0.6)
|
||||
|
||||
var mat_grey = StandardMaterial3D.new()
|
||||
mat_grey.albedo_color = Color(0.3, 0.3, 0.3)
|
||||
|
||||
# Main Tube
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = CylinderMesh.new()
|
||||
b_mesh.top_radius = 0.08
|
||||
b_mesh.bottom_radius = 0.08
|
||||
b_mesh.height = 0.8
|
||||
b_mesh.material = mat_grey
|
||||
body.mesh = b_mesh
|
||||
body.rotation.x = deg_to_rad(90)
|
||||
model_root.add_child(body)
|
||||
|
||||
# Back cone
|
||||
var cone = MeshInstance3D.new()
|
||||
var c_mesh = CylinderMesh.new()
|
||||
c_mesh.top_radius = 0.08
|
||||
c_mesh.bottom_radius = 0.04
|
||||
c_mesh.height = 0.2
|
||||
c_mesh.material = mat_grey
|
||||
cone.mesh = c_mesh
|
||||
cone.rotation.x = deg_to_rad(90)
|
||||
cone.position = Vector3(0, 0, 0.5)
|
||||
model_root.add_child(cone)
|
||||
|
||||
position = Vector3(0.4, -0.4, -0.945)
|
||||
|
||||
var model_scene = load("res://assets/weapons/rocket launcher/source/Law72.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.25, 0.25, 0.25)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.6, 0.2)
|
||||
|
||||
@@ -20,18 +20,19 @@ func _init() -> void:
|
||||
projectile_speed = 25.0 # Slower so they have time to home
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.4, -0.4, -0.6)
|
||||
position = Vector3(0.4, -0.4, -0.656)
|
||||
|
||||
var mat_box = StandardMaterial3D.new()
|
||||
mat_box.albedo_color = Color(0.2, 0.4, 0.5)
|
||||
|
||||
# Box launcher
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.2, 0.2, 0.4)
|
||||
b_mesh.material = mat_box
|
||||
body.mesh = b_mesh
|
||||
model_root.add_child(body)
|
||||
var model_scene = load("res://assets/weapons/swarm launcher/source/LOD_0.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(1.0, 1.0, 1.0)
|
||||
model.rotation_degrees.y = -90
|
||||
model.position.y -= 0.6 # Move model down without moving arms
|
||||
|
||||
# Strip lights
|
||||
for child in model.find_children("*", "Light3D", true, false):
|
||||
child.queue_free()
|
||||
|
||||
# Laser
|
||||
targeting_laser = MeshInstance3D.new()
|
||||
@@ -46,7 +47,7 @@ func _build_model() -> void:
|
||||
l_mesh.material = l_mat
|
||||
targeting_laser.mesh = l_mesh
|
||||
targeting_laser.rotation.x = deg_to_rad(90)
|
||||
targeting_laser.position = Vector3(0, 0, -150.0)
|
||||
targeting_laser.position = Vector3(0, 0, -234.375)
|
||||
targeting_laser.visible = false
|
||||
model_root.add_child(targeting_laser)
|
||||
|
||||
@@ -123,7 +124,7 @@ func _fire() -> void:
|
||||
var tween = create_tween()
|
||||
tween.tween_property(muzzle_flash, "light_energy", 0.0, 0.1)
|
||||
|
||||
var _origin = camera.global_position + camera.global_transform.basis * Vector3(0.4, -0.2, -0.6)
|
||||
var _origin = camera.global_position + camera.global_transform.basis * Vector3(0.4, -0.2, -0.938)
|
||||
var base_dir = -camera.global_transform.basis.z
|
||||
|
||||
_current_aim_dir = base_dir
|
||||
|
||||
@@ -58,7 +58,18 @@ func _setup_viewmodel_viewport() -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if is_instance_valid(vm_camera) and is_instance_valid(camera):
|
||||
vm_camera.global_transform = camera.global_transform
|
||||
vm_camera.fov = camera.fov
|
||||
|
||||
var target_fov = 70.0
|
||||
if is_instance_valid(player) and "velocity" in player:
|
||||
var hspeed = Vector2(player.velocity.x, player.velocity.z).length()
|
||||
if hspeed <= 11.0:
|
||||
var speed_factor = hspeed / 11.0
|
||||
target_fov = lerpf(70.0, 72.0, speed_factor)
|
||||
else:
|
||||
var over_speed_factor = clampf((hspeed - 11.0) / 19.0, 0.0, 1.0) # maxes out at 30 m/s
|
||||
target_fov = lerpf(72.0, 80.0, over_speed_factor)
|
||||
|
||||
vm_camera.fov = lerpf(vm_camera.fov, target_fov, 10.0 * _delta)
|
||||
|
||||
func _build_loadout() -> void:
|
||||
var is_auth = false
|
||||
|
||||