feat: implement plasma gun and rocket swarm mechanics along with various 3D asset imports
This commit is contained in:
+10
-46
@@ -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)
|
||||
|
||||
+12
-41
@@ -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)
|
||||
|
||||
+11
-41
@@ -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
|
||||
|
||||
+18
-41
@@ -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
|
||||
|
||||
+10
-37
@@ -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)
|
||||
|
||||
+16
-16
@@ -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"
|
||||
|
||||
+10
-46
@@ -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)
|
||||
|
||||
+24
-49
@@ -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
-31
@@ -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)
|
||||
|
||||
+10
-28
@@ -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)
|
||||
|
||||
+14
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user