Compare commits

..

2 Commits

Author SHA1 Message Date
d2ed1afdc7 Add modified weapon models 2022-12-07 08:41:10 +01:00
307eec1f4e Add Reload Animation 2022-12-06 15:10:38 +01:00
23 changed files with 444 additions and 285 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +0,0 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://cui8yu4njh1td"]
[ext_resource type="Texture2D" uid="uid://670hioiwiwy0" path="res://assets/Weapons/Gun/untitled.png" id="1_2k5kb"]
[ext_resource type="Texture2D" uid="uid://bsfkj480gegj3" path="res://assets/Weapons/Gun/Revolver_Material_Metallic.png" id="2_3065p"]
[resource]
albedo_texture = ExtResource("1_2k5kb")
metallic = 1.0
metallic_texture = ExtResource("2_3065p")

View File

@@ -1,173 +0,0 @@
{
"asset": {
"generator": "FBX2glTF",
"version": "2.0"
},
"scene": 0,
"buffers": [
{
"byteLength": 66576,
"uri": "buffer.bin"
}
],
"bufferViews": [
{
"buffer": 0,
"byteLength": 7824,
"byteOffset": 0,
"target": 34963
},
{
"buffer": 0,
"byteLength": 22032,
"byteOffset": 7824,
"target": 34962
},
{
"buffer": 0,
"byteLength": 22032,
"byteOffset": 29856,
"target": 34962
},
{
"buffer": 0,
"byteLength": 14688,
"byteOffset": 51888,
"target": 34962
}
],
"scenes": [
{
"name": "Root Scene",
"nodes": [
0
]
}
],
"accessors": [
{
"componentType": 5123,
"type": "SCALAR",
"count": 3912,
"bufferView": 0,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC3",
"count": 1836,
"bufferView": 1,
"byteOffset": 0,
"min": [
-0.015752213075757,
-0.00636364426463842,
-0.056483943015337
],
"max": [
0.015752213075757,
0.131857424974442,
0.00461326725780964
]
},
{
"componentType": 5126,
"type": "VEC3",
"count": 1836,
"bufferView": 2,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC2",
"count": 1836,
"bufferView": 3,
"byteOffset": 0
}
],
"samplers": [
{}
],
"materials": [
{
"name": "Material",
"alphaMode": "OPAQUE",
"extras": {
"fromFBX": {
"shadingModel": "Phong",
"isTruePBR": false
}
},
"pbrMetallicRoughness": {
"baseColorFactor": [
0.800000011920929,
0.800000011920929,
0.800000011920929,
1.0
],
"metallicFactor": 0.400000005960464,
"roughnessFactor": 0.229415729641914
}
}
],
"meshes": [
{
"name": "Cube.011",
"primitives": [
{
"material": 0,
"mode": 4,
"attributes": {
"NORMAL": 2,
"POSITION": 1,
"TEXCOORD_0": 3
},
"indices": 0
}
]
}
],
"nodes": [
{
"name": "RootNode",
"translation": [
0.0,
0.0,
0.0
],
"rotation": [
0.0,
0.0,
0.0,
1.0
],
"scale": [
1.0,
1.0,
1.0
],
"children": [
1
]
},
{
"name": "Cube.011",
"translation": [
-1.86264514923096e-09,
1.2553083896637,
3.58785033226013
],
"rotation": [
-0.707106828689575,
0.0,
0.0,
0.707106709480286
],
"scale": [
100.0,
100.0,
100.0
],
"mesh": 0
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -1,36 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bsfkj480gegj3"
path.s3tc="res://.godot/imported/Revolver_Material_Metallic.png-09ddab5aa35e1ae97c0eefe8e355e0f2.s3tc.ctex"
path.etc2="res://.godot/imported/Revolver_Material_Metallic.png-09ddab5aa35e1ae97c0eefe8e355e0f2.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}
[deps]
source_file="res://assets/Weapons/Gun/Revolver_Material_Metallic.png"
dest_files=["res://.godot/imported/Revolver_Material_Metallic.png-09ddab5aa35e1ae97c0eefe8e355e0f2.s3tc.ctex", "res://.godot/imported/Revolver_Material_Metallic.png-09ddab5aa35e1ae97c0eefe8e355e0f2.etc2.ctex"]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -1,36 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://670hioiwiwy0"
path.s3tc="res://.godot/imported/untitled.png-171f6a3e6ab8f7068ee4dcf93c2569b8.s3tc.ctex"
path.etc2="res://.godot/imported/untitled.png-171f6a3e6ab8f7068ee4dcf93c2569b8.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}
[deps]
source_file="res://assets/Weapons/Gun/untitled.png"
dest_files=["res://.godot/imported/untitled.png-171f6a3e6ab8f7068ee4dcf93c2569b8.s3tc.ctex", "res://.godot/imported/untitled.png-171f6a3e6ab8f7068ee4dcf93c2569b8.etc2.ctex"]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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

Binary file not shown.

View File

@@ -3,13 +3,13 @@
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://beiad4ywiojba"
path="res://.godot/imported/Revolver.gltf-1c0c2c3864f727f53cf3435925795736.scn"
uid="uid://d3sl3ypfxbfmw"
path="res://.godot/imported/Revolver.glb-42b722e7214b13489cbe235a595da532.scn"
[deps]
source_file="res://assets/Weapons/Gun/Revolver.gltf"
dest_files=["res://.godot/imported/Revolver.gltf-1c0c2c3864f727f53cf3435925795736.scn"]
source_file="res://assets/Weapons/Revolver/Revolver.glb"
dest_files=["res://.godot/imported/Revolver.glb-42b722e7214b13489cbe235a595da532.scn"]
[params]
@@ -26,11 +26,4 @@ skins/use_named_skins=true
animation/import=true
animation/fps=30
import_script/path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/path": "res://assets/Weapons/Gun/Gun.tres"
}
}
}
_subresources={}

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -0,0 +1,289 @@
{
"asset": {
"generator": "FBX2glTF",
"version": "2.0"
},
"scene": 0,
"buffers": [
{
"byteLength": 7484,
"uri": "buffer.bin"
}
],
"bufferViews": [
{
"buffer": 0,
"byteLength": 604,
"byteOffset": 0
},
{
"buffer": 0,
"byteLength": 1812,
"byteOffset": 604
},
{
"buffer": 0,
"byteLength": 2416,
"byteOffset": 2416
},
{
"buffer": 0,
"byteLength": 1812,
"byteOffset": 4832
},
{
"buffer": 0,
"byteLength": 72,
"byteOffset": 6644,
"target": 34963
},
{
"buffer": 0,
"byteLength": 288,
"byteOffset": 6716,
"target": 34962
},
{
"buffer": 0,
"byteLength": 288,
"byteOffset": 7004,
"target": 34962
},
{
"buffer": 0,
"byteLength": 192,
"byteOffset": 7292,
"target": 34962
}
],
"scenes": [
{
"name": "Root Scene",
"nodes": [
0
]
}
],
"accessors": [
{
"componentType": 5126,
"type": "SCALAR",
"count": 151,
"bufferView": 0,
"byteOffset": 0,
"min": [
0.0
],
"max": [
6.25
]
},
{
"componentType": 5126,
"type": "VEC3",
"count": 151,
"bufferView": 1,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC4",
"count": 151,
"bufferView": 2,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC3",
"count": 151,
"bufferView": 3,
"byteOffset": 0
},
{
"componentType": 5123,
"type": "SCALAR",
"count": 36,
"bufferView": 4,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC3",
"count": 24,
"bufferView": 5,
"byteOffset": 0,
"min": [
-0.00477957352995872,
-0.00677411770448089,
-0.0176910851150751
],
"max": [
0.00477957399562001,
0.00677412236109376,
0.0176910851150751
]
},
{
"componentType": 5126,
"type": "VEC3",
"count": 24,
"bufferView": 6,
"byteOffset": 0
},
{
"componentType": 5126,
"type": "VEC2",
"count": 24,
"bufferView": 7,
"byteOffset": 0
}
],
"images": [
{
"name": "untitled.png",
"uri": "untitled.png"
}
],
"samplers": [
{}
],
"textures": [
{
"name": "base_color_texture",
"sampler": 0,
"source": 0
}
],
"materials": [
{
"name": "Material.003",
"alphaMode": "OPAQUE",
"extras": {
"fromFBX": {
"shadingModel": "Phong",
"isTruePBR": false
}
},
"pbrMetallicRoughness": {
"baseColorTexture": {
"index": 0,
"texCoord": 0
},
"baseColorFactor": [
1.0,
1.0,
1.0,
1.0
],
"metallicFactor": 0.400000005960464,
"roughnessFactor": 1.0
}
}
],
"meshes": [
{
"name": "Cube.003",
"primitives": [
{
"material": 0,
"mode": 4,
"attributes": {
"NORMAL": 6,
"POSITION": 5,
"TEXCOORD_0": 7
},
"indices": 4
}
]
}
],
"animations": [
{
"name": "Cube.003|Cube.002Action",
"channels": [
{
"sampler": 0,
"target": {
"node": 1,
"path": "translation"
}
},
{
"sampler": 1,
"target": {
"node": 1,
"path": "rotation"
}
},
{
"sampler": 2,
"target": {
"node": 1,
"path": "scale"
}
}
],
"samplers": [
{
"input": 0,
"interpolation": "LINEAR",
"output": 1
},
{
"input": 0,
"interpolation": "LINEAR",
"output": 2
},
{
"input": 0,
"interpolation": "LINEAR",
"output": 3
}
]
}
],
"nodes": [
{
"name": "RootNode",
"translation": [
0.0,
0.0,
0.0
],
"rotation": [
0.0,
0.0,
0.0,
1.0
],
"scale": [
1.0,
1.0,
1.0
],
"children": [
1
]
},
{
"name": "Cube.003",
"translation": [
0.0,
0.0,
0.0
],
"rotation": [
0.289807051420212,
0.644989848136902,
0.644989788532257,
-0.289807081222534
],
"scale": [
93.5872116088867,
93.5872116088867,
93.5872116088867
],
"mesh": 0
}
]
}

View File

@@ -0,0 +1,29 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://0nt2837hvq0i"
path="res://.godot/imported/Magazine.gltf-e920a32b66e939dfd1525af61d83f29d.scn"
[deps]
source_file="res://assets/Weapons/UZI_MAGAZINE/Magazine.gltf"
dest_files=["res://.godot/imported/Magazine.gltf-e920a32b66e939dfd1525af61d83f29d.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
import_script/path=""
_subresources={}

Binary file not shown.

BIN
assets/Weapons/Uzi/Uzi.glb Normal file

Binary file not shown.

View File

@@ -0,0 +1,29 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://qc35m1a5gq81"
path="res://.godot/imported/Uzi.glb-866af1e12117b5342702c3f3313b68b1.scn"
[deps]
source_file="res://assets/Weapons/Uzi/Uzi.glb"
dest_files=["res://.godot/imported/Uzi.glb-866af1e12117b5342702c3f3313b68b1.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
import_script/path=""
_subresources={}

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -9,6 +9,11 @@
config_version=5
_global_script_classes=[{
"base": "Node",
"class": &"Hitable",
"language": &"GDScript",
"path": "res://scripts/player/Hitable.gd"
}, {
"base": "RefCounted",
"class": &"SfxrGenerator",
"language": &"GDScript",
@@ -30,6 +35,7 @@ _global_script_classes=[{
"path": "res://scripts/player/Weapon.gd"
}]
_global_script_class_icons={
"Hitable": "",
"SfxrGenerator": "",
"SfxrGlobals": "",
"SfxrStreamPlayerInterface": "",

View File

@@ -49,3 +49,4 @@ current = true
[node name="AimCast" type="RayCast3D" parent="Body/Head/Camera3D"]
target_position = Vector3(0, 0, -1)
collision_mask = 512

View File

@@ -1,13 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://p3r1q0d3ibmj"]
[ext_resource type="PackedScene" uid="uid://beiad4ywiojba" path="res://assets/Weapons/Gun/Revolver.gltf" id="1_j6rkf"]
[ext_resource type="PackedScene" uid="uid://d3sl3ypfxbfmw" path="res://assets/Weapons/Revolver/Revolver.glb" id="1_8hkoy"]
[node name="Revolver" instance=ExtResource("1_j6rkf")]
transform = Transform3D(0.05, 0, 0, 0, 0.017101, -0.0469845, 0, 0.0469845, 0.017101, 0, -0.5, -0.3)
[node name="RootNode" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.30501, 7.01204)
[node name="Cube011" parent="RootNode" index="0"]
cast_shadow = 0
gi_lightmap_scale = 2
[node name="Revolver" instance=ExtResource("1_8hkoy")]

8
scenes/weapons/Uzi.tscn Normal file
View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="PackedScene" uid="uid://qc35m1a5gq81" path="res://assets/Weapons/Uzi/Uzi.glb" id="1_np5ff"]
[node name="Uzi" instance=ExtResource("1_np5ff")]
[node name="Cube024" parent="." index="0"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0, 0)

View File

@@ -0,0 +1,5 @@
extends Node
class_name Hitable
func Hit():
print("Got hit")

View File

@@ -20,6 +20,9 @@ var MODEL : Node3D
var FIREMODE : int
var HITSCAN : bool
var RAY_LEN : float = 1000
var RELOAD_TIME : float
var RELOAD_MOMENTUM : Vector3
var RELOAD_ANGULAR_MOMENTUM : Vector3
var SHOOTING_SPEED: float
var can_shoot : bool
@@ -32,8 +35,8 @@ func init():
var tween = create_tween()
MODEL.position = DRAW_POS
MODEL.rotation = DRAW_ROT
tween.set_trans(Tween.TRANS_CIRC)
tween.set_ease(Tween.EASE_IN_OUT)
can_shoot = true
tween.tween_callback(InitialPos).set_delay(DRAW_TIME)
@@ -41,8 +44,8 @@ func init():
func InitialPos():
var tween = create_tween()
tween.set_trans(Tween.TRANS_CIRC)
tween.set_ease(Tween.EASE_IN_OUT)
tween.set_trans(Tween.TRANS_QUAD)
tween.set_parallel(true)
tween.tween_property(MODEL, "position", Vector3.ZERO, RECOIL_COOLDOWN / 2)
tween.tween_property(MODEL, "rotation", Vector3.ZERO, RECOIL_COOLDOWN / 2)
@@ -78,7 +81,14 @@ func Release():
func Reload():
if(clip < MAX_CLIP && state == INITIAL):
#state = RELOAD
state = RELOAD
var tween = create_tween()
tween.set_trans(Tween.TRANS_CIRC)
tween.set_ease(Tween.EASE_IN)
tween.set_parallel(true)
tween.tween_property(MODEL, "position", RELOAD_MOMENTUM, RELOAD_TIME)
tween.tween_property(MODEL, "rotation", RELOAD_ANGULAR_MOMENTUM, RELOAD_TIME)
tween.tween_callback(init).set_delay(RELOAD_TIME)
clip = MAX_CLIP
return true
return false

View File

@@ -2,6 +2,7 @@ extends Node3D
const CONFIG_PATH = "user://weapons.scoom"
const REVOLVER = 0
const UZI = 1
const REST = 0
@@ -29,6 +30,29 @@ var file_data = {
"RPM": 120,
"DRAW_POS": Vector3(0,-0.5,-0.3),
"DRAW_ROT": Vector3(1.3, 0, 0),
"RELOAD_MOMENTUM": Vector3(-5, -9, 7),
"RELOAD_ANGULAR_MOMENTUM": Vector3(deg_to_rad(600), deg_to_rad(-800), deg_to_rad(-1000)),
"RELOAD_TIME": 0.35,
"FIREMODE": 0,
"HITSCAN": true
},
UZI:
{
"HAND_POS": Vector3(0.4,-0.45,-1),
"HAND_ROT": Vector3(0,PI,0),
"MODEL": "Uzi",
"MAX_CLIP": 30,
"DAMAGE": 25,
"MOMENTUM": Vector2(0.05, -0.15),
"ANGULAR_MOMENTUM": Vector3(-4, 1, 2),
"RECOIL_COOLDOWN": 0.35,
"RPM": 600,
"DRAW_POS": Vector3(0,-0.5,-0.3),
"DRAW_ROT": Vector3(1.3, 0, 0),
"RELOAD_MOMENTUM": Vector3(-7, -9, 7),
"RELOAD_ANGULAR_MOMENTUM": Vector3(deg_to_rad(600), deg_to_rad(-800), deg_to_rad(-1000)),
"RELOAD_TIME": 0.35,
"FIREMODE": 1,
"HITSCAN": true
}
}
@@ -61,11 +85,15 @@ func _ready():
root.MOMENTUM = file_data[i].MOMENTUM
root.ANGULAR_MOMENTUM = file_data[i].ANGULAR_MOMENTUM
root.RECOIL_COOLDOWN = file_data[i].RECOIL_COOLDOWN
root.RELOAD_MOMENTUM = file_data[i].RELOAD_MOMENTUM
root.RELOAD_ANGULAR_MOMENTUM = file_data[i].RELOAD_ANGULAR_MOMENTUM
root.RELOAD_TIME = file_data[i].RELOAD_TIME
root.RPM = file_data[i].RPM
root.MODEL = root.get_node(file_data[i].MODEL)
root.DRAW_POS = file_data[i].DRAW_POS
root.DRAW_ROT = file_data[i].DRAW_ROT
root.HITSCAN = file_data[i].HITSCAN
root.FIREMODE = file_data[i].FIREMODE
if(not root.HITSCAN):
print("Projectile stats")
@@ -91,7 +119,7 @@ func _unhandled_input(_event):
func ChangeWeapon(i):
weapons[current_weapon].hide()
current_weapon = (i)
current_weapon = i
weapons[current_weapon].init()
raycast.target_position.z = -weapons[current_weapon].RAY_LEN
@@ -113,7 +141,7 @@ func _process(delta):
mouse_mov = Vector3.ZERO
else:
weapons[current_weapon].MODEL.rotation = weapons[current_weapon].MODEL.rotation.lerp(Vector3.ZERO, sway_lerp * delta)
#BOB
if player_root.velocity.length() > 0:
time += delta
@@ -126,7 +154,11 @@ func _process(delta):
func HitScan():
if(raycast.is_colliding()):
var target = raycast.get_collider()
print("Hit target ", target.name)
print_debug("Hit target ", target.name, " with ", weapons[current_weapon].MODEL.name, " ",current_weapon, ". Dealt damage ", weapons[current_weapon].DAMAGE)
if(raycast.get_collision_mask_value(10)):
if(target is Hitable):
target.Hit()
func Projectile():
pass