fixed bug, now equipped items are better
better optimized, no more lagging!!!!!!!!
This commit is contained in:
parent
b32979e38b
commit
62f51b1c13
4 changed files with 21 additions and 19 deletions
|
|
@ -70,18 +70,21 @@ func _input(event: InputEvent) -> void:
|
|||
if not player_state.in_menu:
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
#so it doesnt yank
|
||||
if event.relative.length() > 400:
|
||||
return
|
||||
|
||||
mouse_motion += event.relative
|
||||
mouse_motion_delta = event.relative
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !Console.toggled:
|
||||
handle_joypad_movement(delta)
|
||||
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
player.transform.basis = Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0))
|
||||
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 10)
|
||||
|
||||
if not Console.toggled:
|
||||
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
player.transform.basis = Basis.from_euler(Vector3(0, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0))
|
||||
camera.transform.basis = lerp(camera.transform.basis, Basis.from_euler(Vector3(mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY, 0, 0)), delta * 10)
|
||||
|
||||
if Input.is_action_just_pressed("next_item"):
|
||||
player_manager.next_item()
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ unique_name_in_owner = true
|
|||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0)
|
||||
target_position = Vector3(0, -2, 0)
|
||||
|
||||
[node name="HoldPosition" type="Marker3D" parent="CameraPivot/PlayerCamera" unique_id=923365491]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
|
||||
|
||||
[node name="EquippedItemPosition" type="RigidBody3D" parent="CameraPivot/PlayerCamera" unique_id=1800356500]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5698267)
|
||||
|
|
@ -137,10 +141,6 @@ shape = SubResource("SphereShape3D_b5l5s")
|
|||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, -1)
|
||||
shape = SubResource("CylinderShape3D_g4v7s")
|
||||
|
||||
[node name="SelectedItemPosition" type="Marker3D" parent="CameraPivot/PlayerCamera" unique_id=923365491]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5117141, -0.34773195, -0.8300779)
|
||||
|
||||
[node name="PlayerListener" type="AudioListener3D" parent="CameraPivot" unique_id=1468948553]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7621309, 0)
|
||||
doppler_tracking = 2
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ var inventory: Array[RigidBody3D] = [null,null]
|
|||
@onready var ui: Control = %PlayerUi
|
||||
@onready var flashlight: SpotLight3D = %Flashlight
|
||||
@onready var equipped_item_mesh: MeshInstance3D = %EquippedItemMesh
|
||||
@onready var hold_position: Marker3D = %HoldPosition
|
||||
|
||||
var selected_item_object: RigidBody3D = null
|
||||
|
||||
|
|
@ -97,6 +98,8 @@ func drop_item(index: int = selected_item):
|
|||
|
||||
object.collision_layer = 17
|
||||
object.add_to_group("equippable")
|
||||
object.global_position = hold_position.global_position
|
||||
object.visible = true
|
||||
|
||||
for child in object.get_children():
|
||||
if child is CollisionObject3D:
|
||||
|
|
@ -106,6 +109,7 @@ func drop_item(index: int = selected_item):
|
|||
|
||||
func remove_item(index: int):
|
||||
inventory[index] = null
|
||||
select_item(index)
|
||||
ui.remove_item(index)
|
||||
|
||||
func get_selected_item() -> RigidBody3D:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
// Fetches the screen texture with mipmaps enabled for the blur effect
|
||||
// filter_linear_mipmap tells Godot to generate the blurred layers!
|
||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||
|
||||
// Allows you to adjust the blur strength in the inspector
|
||||
uniform float blur_amount : hint_range(0.0, 5.0) = 2.5;
|
||||
uniform float blur_amount : hint_range(0.0, 5.0) = 2.0;
|
||||
|
||||
void fragment() {
|
||||
// Sample the screen texture at the current screen UV, using the blur_amount as the mipmap level (LOD)
|
||||
vec4 blurred_color = textureLod(screen_texture, SCREEN_UV, blur_amount);
|
||||
|
||||
// Output the blurred color
|
||||
COLOR = blurred_color;
|
||||
// textureLod grabs the pre-blurred image directly. No loops required!
|
||||
COLOR = textureLod(screen_texture, SCREEN_UV, blur_amount);
|
||||
}
|
||||
Loading…
Reference in a new issue