mostly have mouse look working, need to figure out why collision mask binary 8 also includes 6??

This commit is contained in:
derek
2025-06-26 10:54:22 -05:00
parent 36cde498e0
commit abe877c5da
8 changed files with 58 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://hmyrn2pbbhpm"]
[gd_scene load_steps=8 format=3 uid="uid://hmyrn2pbbhpm"]
[ext_resource type="Script" uid="uid://bici4k5vkuoos" path="res://Scripts/player_camera.gd" id="1_ocbkm"]
[ext_resource type="Script" uid="uid://bnqpqdped5uw2" path="res://Scripts/camera_Look.gd" id="2_8uhk6"]
@@ -17,6 +17,9 @@ bg_color = Color(0.458824, 0, 0.145098, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8uhk6"]
bg_color = Color(0.457868, 0.677542, 0.145981, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_8uhk6"]
size = Vector3(30, 1, 30)
[node name="CameraFollow" type="Node3D"]
script = ExtResource("1_ocbkm")
@@ -63,3 +66,12 @@ size_flags_horizontal = 0
size_flags_vertical = 0
theme = ExtResource("3_8uhk6")
text = "Gold: 35"
[node name="MouseTable" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
collision_layer = 128
collision_mask = 128
priority = 1
[node name="CollisionShape3D" type="CollisionShape3D" parent="MouseTable"]
shape = SubResource("BoxShape3D_8uhk6")

View File

@@ -36,22 +36,6 @@ tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = PackedFloat32Array(0, 1, 0.652269, 0.475497, -0.696594)
[sub_resource type="Animation" id="Animation_hck1p"]
resource_name = "dodge"
step = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:rotation")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0, 0, 6.28319)]
}
[sub_resource type="Animation" id="Animation_4qbli"]
resource_name = "attack"
length = 0.5
@@ -70,6 +54,23 @@ tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = PackedFloat32Array(0, 1, 0, -0.86255, 0, 0.505973, 0.166667, 1, 0, 0.949105, 0, -0.314961, 0.193146, 1, 0, 0.949105, 0, -0.314961, 0.3, 1, 0, -0.371061, 0, 0.928609, 0.433352, 1, 0, -0.86255, 0, 0.505973)
[sub_resource type="Animation" id="Animation_hck1p"]
resource_name = "dodge"
length = 0.3
step = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:rotation")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0, 0, 6.28319)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4qbli"]
_data = {
&"RESET": SubResource("Animation_juxdh"),
@@ -115,7 +116,7 @@ metadata/extras = {
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, -0.5, 0.0393383)
[node name="ShittySword" type="MeshInstance3D" parent="Body"]
transform = Transform3D(-0.487984, 0, -0.872853, 0, 1, 0, 0.872853, 0, -0.487984, 0.652269, 0.475497, -0.696594)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.652269, 0.475497, -0.696594)
mesh = SubResource("BoxMesh_5wxv7")
skeleton = NodePath("../..")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://dbqyyunvx6fdj"]
[gd_scene load_steps=15 format=3 uid="uid://dbqyyunvx6fdj"]
[ext_resource type="PackedScene" uid="uid://hmyrn2pbbhpm" path="res://Prefabs/PlayerCamera.tscn" id="2_qq11w"]
[ext_resource type="PackedScene" uid="uid://bacgd5lmvaxea" path="res://Prefabs/player.tscn" id="3_hfnh2"]
@@ -9,6 +9,7 @@
[ext_resource type="PackedScene" uid="uid://d0u2u3cvfkdlj" path="res://Assets/Models/Test1.blend" id="8_46b76"]
[ext_resource type="PackedScene" uid="uid://dctwrgdviw2bq" path="res://Prefabs/rat.tscn" id="8_igv2b"]
[ext_resource type="PackedScene" uid="uid://1shngq3vrbu" path="res://coin_spawner.tscn" id="9_46b76"]
[ext_resource type="PackedScene" uid="uid://jkl8odkxg2s2" path="res://mousedebug.tscn" id="10_tadml"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_31lxn"]
sky_top_color = Color(0.1, 0.1, 0.1, 1)
@@ -165,3 +166,6 @@ transform = Transform3D(0.0790682, 0, 0.996869, 0, 1, 0, -0.996869, 0, 0.0790682
[node name="CoinSpawner" parent="." instance=ExtResource("9_46b76")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.81324, 3.94453, 0.757049)
[node name="MOUSEDEBUG" parent="." instance=ExtResource("10_tadml")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.21551, 0.500001, -0.339623)

6
Scripts/mouseDebug.gd Normal file
View File

@@ -0,0 +1,6 @@
extends Node3D
func _process(delta: float) -> void:
var mouse_pos = MousePos.get_mouse_world_position(00001000)
if mouse_pos != null:
global_position = mouse_pos

View File

@@ -0,0 +1 @@
uid://cne68wmdyr4ld

View File

@@ -3,7 +3,7 @@
extends Node3D
const RAY_LENGTH := 1000
const RAY_LENGTH := 5000
"""
Uses default collision_mask. But can be overrided for custom collision
@@ -33,7 +33,7 @@ func _do_raycast_on_mouse_position(collision_mask: int = 0b00000000_00000000_000
query.collide_with_areas = true
query.collision_mask = collision_mask
var result = space_state.intersect_ray(query) # raycast result
var result = space_state.intersect_ray(query) # raycast result
return result

View File

@@ -39,9 +39,9 @@ func apply_gravity(delta):
character.velocity.y -= 9.8 * delta
func body_look_at_mouse():
var mouse_raycast = MousePos.get_mouse_world_position()
var mouse_raycast = MousePos.get_mouse_world_position(1000)
if mouse_raycast != null:
character.body.look_at(Vector3(mouse_raycast.x,character.body.global_position.y,mouse_raycast.y),Vector3.UP)
character.body.look_at(Vector3(mouse_raycast.x,character.body.global_position.y,mouse_raycast.z),Vector3.UP)
func standard_movement(delta):
if character.is_on_floor():

11
mousedebug.tscn Normal file
View File

@@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://jkl8odkxg2s2"]
[ext_resource type="Script" uid="uid://cne68wmdyr4ld" path="res://Scripts/mouseDebug.gd" id="1_ehadm"]
[sub_resource type="SphereMesh" id="SphereMesh_ehadm"]
[node name="MOUSEDEBUG" type="Node3D"]
script = ExtResource("1_ehadm")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_ehadm")