fixed moveables
This commit is contained in:
@@ -80,6 +80,8 @@ offset_bottom = 2160.0
|
||||
[node name="PlaylistGenerator" parent="." instance=ExtResource("2_2rg1o")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
generate_playlist_now = false
|
||||
checksum_test = false
|
||||
maps_in_rotation = Array[ExtResource("4_p7b2e")]([SubResource("Resource_3w5k4"), SubResource("Resource_t5q6w"), SubResource("Resource_2pkld"), SubResource("Resource_hgnbd")])
|
||||
gamemodes_in_rotation = Array[ExtResource("4_p0ng4")]([ExtResource("5_lv7ko"), ExtResource("7_vm4j1"), ExtResource("8_bexpg")])
|
||||
levels_per_round = 4
|
||||
@@ -116,6 +118,7 @@ theme = ExtResource("2_3fflq")
|
||||
selected = 0
|
||||
item_count = 1
|
||||
popup/item_0/text = "Global"
|
||||
popup/item_0/id = 0
|
||||
|
||||
[node name="Add Leaderboard" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bcjo4q16i4qc4"
|
||||
uid="uid://eu3jtc4b45tf"
|
||||
path.s3tc="res://.godot/imported/MT_PM_V60_Acer_buergerianum_01_Trunk_01_albedo.jpg-4feb9655bc77180a4dec25131ce56284.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cgpmyiyweyvl0"
|
||||
uid="uid://btpareyrft5w1"
|
||||
path.s3tc="res://.godot/imported/blunderbus.stock.normal2.png-6234e83c6873106e0a0a1afe87946f83.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://du5psl01pl58u"
|
||||
uid="uid://dypcs5eicgvec"
|
||||
path.s3tc="res://.godot/imported/boxcar1.normal.png-8bdba2ecd2fc35b66a42364ceaf4c1a4.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cixlw3pnskjm4"
|
||||
uid="uid://cvdh3jecb65ka"
|
||||
path.s3tc="res://.godot/imported/boxcar1.rough.png-b98b532f135d29d0f2d055fdfc8a167f.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://oeyauoofbcdf"
|
||||
uid="uid://cprosq81sf424"
|
||||
path.s3tc="res://.godot/imported/boxcar1.wheel.rough.png-89ad26eb2f1d458e6b8a6881822a3cc7.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://caboww85wl3r3"
|
||||
uid="uid://cuiwcyxkgx0ki"
|
||||
path.s3tc="res://.godot/imported/rat1.roughness.png-7ef4c9ed5c9e7822f363c78772f6efff.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dmyn4eq2r12ue"
|
||||
uid="uid://c6nvp1khihvhj"
|
||||
path.s3tc="res://.godot/imported/spider1.albedoRAW.png-554035c2ec6547ea52187d52cfffea31.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cjpvdne166r8d"
|
||||
uid="uid://bw77aa6iw6bms"
|
||||
path.s3tc="res://.godot/imported/Leaves1.albedo.png-d9f0c25705eb26e67187a73d8678b48f.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://845he24pmgv4"
|
||||
uid="uid://n23cy8atlc41"
|
||||
path.s3tc="res://.godot/imported/vendingmachine.main.roughness.png-bfae5d8f598ca008717f91592c809128.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
|
||||
@@ -791,7 +791,7 @@ target_position = Vector3(0, 0, -1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_mcns2")
|
||||
&"": SubResource("AnimationLibrary_mcns2")
|
||||
}
|
||||
|
||||
[node name="SmokeTimer" type="Timer" parent="."]
|
||||
|
||||
@@ -814,7 +814,7 @@ skeleton = NodePath("../../../../../..")
|
||||
|
||||
[node name="GunAnims" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_vkrtt")
|
||||
&"": SubResource("AnimationLibrary_vkrtt")
|
||||
}
|
||||
|
||||
[node name="Audio" type="Node3D" parent="."]
|
||||
|
||||
@@ -1518,7 +1518,7 @@ transform = Transform3D(-1.20667e-05, -3.33333, 0, 3.33333, -1.20667e-05, 0, 0,
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_2kb78")
|
||||
&"": SubResource("AnimationLibrary_2kb78")
|
||||
}
|
||||
|
||||
[node name="Audio" type="Node3D" parent="."]
|
||||
|
||||
@@ -362,8 +362,9 @@ margin = 0.001
|
||||
size = Vector3(1, 0.524719, 0.556091)
|
||||
|
||||
[node name="Chest1" type="RigidBody3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
collision_layer = 32
|
||||
collision_mask = 365
|
||||
collision_mask = 109
|
||||
mass = 45.0
|
||||
continuous_cd = true
|
||||
script = ExtResource("1_0qjnf")
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="First Person Test"
|
||||
run/main_scene="res://scenes/asset_checker.tscn"
|
||||
run/main_scene="uid://jdwpc622vmok"
|
||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -88,12 +88,7 @@ var dead = false
|
||||
var hud_visible : bool = true
|
||||
|
||||
var held_item : Node
|
||||
var held_item_linear_damp_cache
|
||||
var held_item_angular_damp_cache
|
||||
var held_item_gravity_cache
|
||||
var held_item_mass_cache
|
||||
var held_item_collision_cache
|
||||
var hold_offset
|
||||
var held_item_cache = {}
|
||||
var held_item_rotation : float = 0
|
||||
|
||||
var gamespeed_controlled = false
|
||||
@@ -459,22 +454,16 @@ func _physics_process(delta):
|
||||
controlled_elsewhere = false
|
||||
|
||||
#interact button
|
||||
if Input.is_action_pressed("interact"):
|
||||
held_key_check += delta
|
||||
## IF HELD
|
||||
if held_key_check >= HELD_BUTTON_AMT:
|
||||
if interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().has_method("interact"):
|
||||
body.interact()
|
||||
held_key_check = 0.0
|
||||
elif Input.is_action_just_released("interact"):
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
elif interact_ray.is_colliding():
|
||||
if interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().get_class() == "RigidBody3D":
|
||||
grab_moveable(body)
|
||||
elif interact_ray.get_collider().has_method("interact"):
|
||||
body.interact()
|
||||
|
||||
held_key_check = 0.0
|
||||
#kick
|
||||
if Input.is_action_just_pressed("kick"):
|
||||
@@ -606,23 +595,6 @@ func aim_down_sights(delta):
|
||||
else:
|
||||
gun.position = lerp(gun.position, weapon_start_pos,(delta * 100)/Engine.time_scale)
|
||||
|
||||
func grab_moveable(body):
|
||||
holster_gun(true)
|
||||
held_item = body
|
||||
#cache rigidbody settings
|
||||
held_item_linear_damp_cache = body.linear_damp
|
||||
held_item_angular_damp_cache = body.angular_damp
|
||||
held_item_gravity_cache = body.gravity_scale
|
||||
held_item_mass_cache = body.mass
|
||||
held_item_collision_cache = held_item.get_collision_layer_value(1)
|
||||
hold_offset = held_item.global_position - interact_ray.get_collision_point()
|
||||
#change rigidbody settings
|
||||
body.linear_damp = 0 #5
|
||||
body.angular_damp = 0 #5
|
||||
body.mass = 1
|
||||
held_item.gravity_scale = 0
|
||||
held_item.set_collision_layer_value(1,false)
|
||||
|
||||
func hud_wobble(delta):
|
||||
var viewport_height_adj = (get_viewport().size.y/1080)
|
||||
|
||||
@@ -640,31 +612,32 @@ func hud_wobble(delta):
|
||||
hud.position = offset
|
||||
hud.crosshair.position = -offset
|
||||
|
||||
func grab_moveable(body):
|
||||
held_item_cache = {
|
||||
"gravity_scale" : body.gravity_scale
|
||||
}
|
||||
body.gravity_scale = 0
|
||||
moveable_holder.add_child(body)
|
||||
body.global_position = moveable_holder.global_position
|
||||
for i in body.get_children():
|
||||
if i.get_class() == "CollisionShape3D":
|
||||
i.disabled = true
|
||||
held_item = body
|
||||
|
||||
func hold_item(_delta):
|
||||
# Move Held Items
|
||||
if held_item != null:
|
||||
interact_ray.look_at(held_item.global_position, Vector3.UP)
|
||||
var held_dir = (moveable_holder.global_position - held_item.global_position)
|
||||
held_item.linear_velocity = held_dir * 50
|
||||
held_item.rotation = Vector3(0,held_item_rotation,0) + Vector3(0,camera.global_rotation.y,0)
|
||||
#break when moved too far away
|
||||
var distance_from_player = abs(self.global_position - held_item.global_position)
|
||||
if distance_from_player.length() > 5:
|
||||
release_moveable()
|
||||
if stand_check.is_colliding():
|
||||
if stand_check.get_collider() == held_item:
|
||||
release_moveable()
|
||||
const FORCE = 10
|
||||
var dir = moveable_holder.global_position - held_item.global_position
|
||||
held_item.linear_velocity = dir * FORCE + self.velocity
|
||||
held_item.look_at(camera.global_position,Vector3(0,1,0))
|
||||
|
||||
func release_moveable():
|
||||
holster_gun(false)
|
||||
if held_item != null:
|
||||
held_item.gravity_scale = held_item_gravity_cache
|
||||
held_item.linear_damp = held_item_linear_damp_cache
|
||||
held_item.angular_damp = held_item_angular_damp_cache
|
||||
held_item.mass = held_item_mass_cache
|
||||
held_item.set_collision_layer_value(1,held_item_collision_cache)
|
||||
held_item = null
|
||||
hold_offset = null
|
||||
held_item.gravity_scale = held_item_cache["gravity_scale"]
|
||||
for i in held_item.get_children():
|
||||
if i.get_class() == "CollisionShape3D":
|
||||
i.disabled = false
|
||||
get_tree().current_scene.add_child(held_item)
|
||||
held_item = null
|
||||
|
||||
## GUNS AND AMMO
|
||||
func holster_gun(holster):
|
||||
|
||||
Reference in New Issue
Block a user