added getglobalmouseposition function
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=12 format=3 uid="uid://bj7y7q2qkpnci"]
|
[gd_scene load_steps=13 format=3 uid="uid://bj7y7q2qkpnci"]
|
||||||
|
|
||||||
[ext_resource type="ArrayMesh" uid="uid://p3d7iitismhf" path="res://Blends/Cart/cart-bottom.obj" id="2_8gbba"]
|
[ext_resource type="ArrayMesh" uid="uid://p3d7iitismhf" path="res://Blends/Cart/cart-bottom.obj" id="2_8gbba"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://cayqoyyq7nbij" path="res://Blends/Cart/cart-top.obj" id="3_jjvhh"]
|
[ext_resource type="ArrayMesh" uid="uid://cayqoyyq7nbij" path="res://Blends/Cart/cart-top.obj" id="3_jjvhh"]
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://h1bl3q1pjjnm" path="res://Blends/textures/snow_02_rough_4k.jpg" id="5_21xkr"]
|
[ext_resource type="Texture2D" uid="uid://h1bl3q1pjjnm" path="res://Blends/textures/snow_02_rough_4k.jpg" id="5_21xkr"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://dpmtd0n5wyucx" path="res://Blends/Cart/wheels.obj" id="5_kry3j"]
|
[ext_resource type="ArrayMesh" uid="uid://dpmtd0n5wyucx" path="res://Blends/Cart/wheels.obj" id="5_kry3j"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://ws8ddp6stf3s" path="res://Blends/ground.obj" id="6_6bp64"]
|
[ext_resource type="ArrayMesh" uid="uid://ws8ddp6stf3s" path="res://Blends/ground.obj" id="6_6bp64"]
|
||||||
|
[ext_resource type="Script" uid="uid://drrp1k2q71hq2" path="res://Scripts/camera_3d.gd" id="7_6bp64"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_344ge"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_344ge"]
|
||||||
albedo_texture = ExtResource("5_21xkr")
|
albedo_texture = ExtResource("5_21xkr")
|
||||||
@@ -15,7 +16,7 @@ albedo_texture = ExtResource("5_21xkr")
|
|||||||
metallic = 0.31
|
metallic = 0.31
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_jjvhh"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_jjvhh"]
|
||||||
size = Vector3(158.899, 1, 159.805)
|
size = Vector3(172.382, 1, 159.805)
|
||||||
|
|
||||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_21xkr"]
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_21xkr"]
|
||||||
lifetime_randomness = 0.55
|
lifetime_randomness = 0.55
|
||||||
@@ -78,11 +79,18 @@ mesh = ExtResource("6_6bp64")
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.9207, -0.00321198, -0.742706)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.9207, -0.00321198, -0.742706)
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground/StaticBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground/StaticBody3D"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.167175, 0, -0.376099)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.57438, 0, -0.376099)
|
||||||
shape = SubResource("BoxShape3D_jjvhh")
|
shape = SubResource("BoxShape3D_jjvhh")
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.710217, 0.703983, 0, -0.703983, 0.710217, -16.0276, 52.362, -52.6538)
|
transform = Transform3D(1, 0, 0, 0, 0.710217, 0.703983, 0, -0.703983, 0.710217, -16.0276, 52.362, -52.6538)
|
||||||
|
script = ExtResource("7_6bp64")
|
||||||
|
rayLength = 1000.0
|
||||||
|
|
||||||
|
[node name="DebugLabel1" type="Label" parent="Camera3D"]
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 23.0
|
||||||
|
text = "Text"
|
||||||
|
|
||||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
||||||
transform = Transform3D(3.70763, 0, 0, 0, 2.24982, 0, 0, 0, 3.71542, -7.77808, 47.2887, -60.0289)
|
transform = Transform3D(3.70763, 0, 0, 0, 2.24982, 0, 0, 0, 3.71542, -7.77808, 47.2887, -60.0289)
|
||||||
|
|||||||
11
Scripts/camera_3d.gd
Normal file
11
Scripts/camera_3d.gd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
extends Camera3D
|
||||||
|
|
||||||
|
@export var rayLength: float
|
||||||
|
func getGlobalMousePosition() -> Vector3:
|
||||||
|
var space = get_world_3d().direct_space_state
|
||||||
|
var mousePos = get_viewport().get_mouse_position()
|
||||||
|
var from = self.project_ray_origin(mousePos)
|
||||||
|
var to = from + self.project_ray_normal(mousePos) * rayLength
|
||||||
|
var query = PhysicsRayQueryParameters3D.create(from,to)
|
||||||
|
var collison = space.intersect_ray(query)
|
||||||
|
return collison.position
|
||||||
1
Scripts/camera_3d.gd.uid
Normal file
1
Scripts/camera_3d.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://drrp1k2q71hq2
|
||||||
Reference in New Issue
Block a user