players can now apply rigidbody push force

This commit is contained in:
2024-01-22 12:20:11 +01:00
parent 06ab5431c8
commit d9c0201f6c
7 changed files with 47 additions and 29 deletions

View File

@@ -99,7 +99,6 @@ gravity_change={
anti_aliasing/quality/msaa_3d=1
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_taa=true
anti_aliasing/quality/use_debanding=true
occlusion_culling/use_occlusion_culling=true
environment/defaults/default_environment="res://resources/environment.tres"
environment/defaults/default_clear_color.release=Color(0, 0, 0, 1)

View File

@@ -81,7 +81,7 @@ initial_velocity_min = 10.0
initial_velocity_max = 10.0
[sub_resource type="Curve" id="Curve_xucvk"]
_data = [Vector2(0.0245902, 0), 0.0, 1.4, 0, 0, Vector2(0.172131, 0), 1.65004, 0.0, 0, 0]
_data = [Vector2(0.0245902, 0), 0.0, -0.0514974, 0, 0, Vector2(0.766827, 0), 0.00682321, 0.0, 0, 0]
point_count = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_endjk"]
@@ -95,7 +95,8 @@ use_particle_trails = true
[sub_resource type="RibbonTrailMesh" id="RibbonTrailMesh_fwaab"]
material = SubResource("StandardMaterial3D_endjk")
size = 12.0
size = 18.0
sections = 8
section_length = 0.3
section_segments = 2
curve = SubResource("Curve_xucvk")
@@ -176,9 +177,9 @@ transform = Transform3D(0.999923, -0.012392, 0.000616441, 0.0123854, 0.999875, 0
size = Vector3(1.17664, 0.301201, 0.299805)
[node name="GravityParticles" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Node3D/Camera3D/MeshInstance3D"]
transform = Transform3D(1, -2.79397e-08, 8.70349e-09, 1.9744e-07, 1, 5.83791e-08, -7.93013e-09, -5.67382e-07, 1, 1, 0.1, 0)
transform = Transform3D(1, -2.79397e-08, 8.70349e-09, 1.9744e-07, 1, 5.83791e-08, -7.93013e-09, -5.67382e-07, 1, 1, 0, 0)
visible = false
amount = 20
amount = 50
lifetime = 0.1
visibility_aabb = AABB(0.0726342, 0.335538, 0.399176, 0.593013, 0.887273, 1.34056)
trail_enabled = true

View File

@@ -3,7 +3,6 @@
[ext_resource type="PackedScene" uid="uid://gg5ph541e4p3" path="res://scenes/player.tscn" id="1_2585i"]
[ext_resource type="PackedScene" uid="uid://ddwkhfly2xyyt" path="res://assets/models/interior.obj" id="1_lphcl"]
[ext_resource type="Texture2D" uid="uid://bu7e43m8dswwk" path="res://assets/textures/material/tilesslatesquare/tilesslatesquare_col.png" id="2_irc8l"]
[ext_resource type="PackedScene" uid="uid://b8bvidqu7tmfs" path="res://scenes/objects/interactables/task_terminal.tscn" id="3_30m3x"]
[ext_resource type="Texture2D" uid="uid://dkggxcnlqd2rb" path="res://assets/textures/material/tilesslatesquare/tilesslatesquare_ao.png" id="3_465hc"]
[ext_resource type="PackedScene" uid="uid://dqy8bqf1chm8c" path="res://scenes/objects/interactables/button_stand.tscn" id="4_cruoa"]
[ext_resource type="Texture2D" uid="uid://bsklw2r406fc7" path="res://assets/textures/material/tilesslatesquare/tilesslatesquare_metalness.png" id="4_sn3wt"]
@@ -15,6 +14,7 @@
[ext_resource type="Texture2D" uid="uid://bs0qseslb0ilu" path="res://assets/textures/material/tiles_white/tiles_white_ambientocclusion.png" id="8_wcubh"]
[ext_resource type="Texture2D" uid="uid://cpw4myruauqs6" path="res://assets/textures/material/tiles_white/tiles_white_normal.png" id="9_xs8gx"]
[ext_resource type="Texture2D" uid="uid://uy7vdufb7mhc" path="res://assets/textures/material/tiles_white/tiles_white_roughness.png" id="10_mli04"]
[ext_resource type="PackedScene" uid="uid://ced2w03t8er5k" path="res://scenes/objects/cube.tscn" id="15_h1ivu"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dkjw0"]
albedo_texture = ExtResource("2_irc8l")
@@ -26,11 +26,14 @@ normal_texture = ExtResource("5_pffg3")
ao_enabled = true
ao_texture = ExtResource("3_465hc")
uv1_scale = Vector3(35, 35, 35)
uv1_triplanar_sharpness = 0.148651
uv1_world_triplanar = true
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cl8ik"]
albedo_texture = ExtResource("7_qai4q")
roughness_texture = ExtResource("10_mli04")
normal_enabled = true
normal_scale = 1.5
normal_texture = ExtResource("9_xs8gx")
ao_enabled = true
ao_texture = ExtResource("8_wcubh")
@@ -52,25 +55,32 @@ surface_material_override/0 = SubResource("StandardMaterial3D_dkjw0")
[node name="Cube" parent="interior" index="1"]
surface_material_override/0 = SubResource("StandardMaterial3D_cl8ik")
[node name="StaticBody3D" parent="interior/Cube" index="0"]
collision_priority = 2000.0
[node name="Player" parent="." instance=ExtResource("1_2585i")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 5.23956)
[node name="TaskTerminal" parent="." instance=ExtResource("3_30m3x")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.5, 0.027395, 0)
[node name="ButtonStand" parent="." instance=ExtResource("4_cruoa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0.7, 0)
one_shot = true
[node name="CompletionCounter" parent="." node_paths=PackedStringArray("nodes_needed") instance=ExtResource("5_lo1l3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0617981, 3.05379, 6.24098)
nodes_needed = [NodePath("../ButtonStand"), NodePath("../ButtonStand2")]
nodes_needed = [NodePath("../ButtonStand"), NodePath("../ButtonStand2"), NodePath("../ButtonStand3")]
[node name="Door" parent="." instance=ExtResource("6_853p2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1, 1.425, 6.64)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1, 1.58488, 6.64)
[node name="ButtonStand2" parent="." instance=ExtResource("4_cruoa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0.7, 4)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.03802, 0.7, 6)
[node name="ButtonStand3" parent="." instance=ExtResource("4_cruoa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0.7, 2)
[node name="Cube" parent="." instance=ExtResource("15_h1ivu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
collision_priority = 2.0
[connection signal="lock" from="CompletionCounter" to="Door" method="close"]
[connection signal="unlock" from="CompletionCounter" to="Door" method="open"]

View File

@@ -1,7 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://dji1rniuusnmy"]
[gd_scene load_steps=5 format=3 uid="uid://dji1rniuusnmy"]
[ext_resource type="Script" path="res://scripts/menus/main_menu.gd" id="1_1osxu"]
[ext_resource type="Texture2D" uid="uid://bt1ywpvnxswet" path="res://assets/textures/branding/logo.png" id="2_ff1yt"]
[sub_resource type="LabelSettings" id="LabelSettings_yh38l"]
font_size = 55
@@ -41,18 +40,6 @@ size_flags_horizontal = 4
text = "Byte of Terrror"
label_settings = SubResource("LabelSettings_yh38l")
[node name="Subtitle" type="Label" parent="LogoContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "ein Spiel von Yannik Ain und Merle Jacob für das"
[node name="TextureRect" type="TextureRect" parent="LogoContainer"]
custom_minimum_size = Vector2(180, 70)
layout_mode = 2
size_flags_horizontal = 4
texture = ExtResource("2_ff1yt")
expand_mode = 1
[node name="StartGame" type="Button" parent="."]
layout_mode = 1
anchors_preset = 7

View File

@@ -1,13 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://ced2w03t8er5k"]
[sub_resource type="BoxShape3D" id="BoxShape3D_x5eli"]
[sub_resource type="BoxShape3D" id="BoxShape3D_flqji"]
[sub_resource type="BoxMesh" id="BoxMesh_evnha"]
[node name="Cube" type="RigidBody3D"]
[node name="Cube" type="RigidBody3D" groups=["pushables"]]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_x5eli")
shape = SubResource("BoxShape3D_flqji")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_evnha")

View File

@@ -38,4 +38,15 @@ visible = false
mesh = SubResource("QuadMesh_dicpk")
script = ExtResource("2_jg7te")
[node name="SpringArm3D" type="SpringArm3D" parent="Camera3D"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
spring_length = 10.0
[node name="GravityGunGoal" type="Node3D" parent="Camera3D/SpringArm3D"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, -8.69771e-07, 0, 9.94902)
[node name="RayCast3D" type="RayCast3D" parent="Camera3D"]
target_position = Vector3(0, 0, -10)
debug_shape_custom_color = Color(0, 0, 0, 0)
[node name="GravityGun" parent="." instance=ExtResource("2_ahuce")]

View File

@@ -12,6 +12,9 @@ var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
var camera_senitivity: float = 0.5
@onready var gravity_gun_goal: Node3D = $Camera3D/SpringArm3D/GravityGunGoal
@onready var raycast: RayCast3D = $Camera3D/RayCast3D
func _ready() -> void:
capture()
camera.make_current()
@@ -36,6 +39,13 @@ func _physics_process(delta: float) -> void:
velocity.z = move_toward(velocity.z, 0, SPEED * delta * 50)
move_and_slide()
# Pushing other objects
for col_idx in get_slide_collision_count():
var col := get_slide_collision(col_idx)
if col.get_collider() is RigidBody3D:
col.get_collider().apply_central_impulse(-col.get_normal() * 0.3)
col.get_collider().apply_impulse(-col.get_normal() * 0.01, col.get_position())
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion && Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: