first init

This commit is contained in:
2025-12-22 15:14:38 +01:00
commit bc75750128
30 changed files with 1660 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://crfjfbhjuderh"
path="res://.godot/imported/Thruster Cube Collision.glb-e95615f3a01fd673f0dafc758072d75c.scn"
[deps]
source_file="res://Assets/Thruster Cube Collision.glb"
dest_files=["res://.godot/imported/Thruster Cube Collision.glb-e95615f3a01fd673f0dafc758072d75c.scn"]
[params]
nodes/root_type="CollisionShape3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=0

View File

@@ -0,0 +1,12 @@
# Blender 4.5.1 LTS MTL File: 'Thruster Cube Collision.blend'
# www.blender.org
newmtl Standard.001
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.244501 0.244501 0.244501
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://c7f1y6fhexbhm"
path="res://.godot/imported/Thruster Cube Collision.obj-b25b556e6c42aebde4547600bcacd901.mesh"
[deps]
files=["res://.godot/imported/Thruster Cube Collision.obj-b25b556e6c42aebde4547600bcacd901.mesh"]
source_file="res://Assets/Thruster Cube Collision.obj"
dest_files=["res://.godot/imported/Thruster Cube Collision.obj-b25b556e6c42aebde4547600bcacd901.mesh", "res://.godot/imported/Thruster Cube Collision.obj-b25b556e6c42aebde4547600bcacd901.mesh"]
[params]
generate_tangents=true
generate_lods=true
generate_shadow_mesh=true
generate_lightmap_uv2=false
generate_lightmap_uv2_texel_size=0.2
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
force_disable_mesh_compression=false

BIN
Assets/Thruster Cube.glb Normal file

Binary file not shown.

View File

@@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cmiwlha25agl4"
path="res://.godot/imported/Thruster Cube.glb-02382f7bdc8ae9a0011d286e98d4c123.scn"
[deps]
source_file="res://Assets/Thruster Cube.glb"
dest_files=["res://.godot/imported/Thruster Cube.glb-02382f7bdc8ae9a0011d286e98d4c123.scn"]
[params]
nodes/root_type="RigidBody3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

15
Assets/obstacle.tscn Normal file
View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://cc7e4loxpb1x6"]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_lapuk"]
points = PackedVector3Array(-0.5, -1, 0, -0.497651, -1, -0.0490407, -0.497651, -1, 0.0489429, -0.5, 1, 0, -0.490407, -1, -0.097592, -0.497651, 1, -0.0490407, -0.490407, -1, 0.0974941, -0.497651, 1, 0.0489429, -0.478563, -1, -0.145164, -0.490407, 1, -0.097592, -0.478563, -1, 0.145067, -0.490407, 1, 0.0974941, -0.46202, -1, -0.191366, -0.478563, 1, -0.145164, -0.46202, -1, 0.191269, -0.478563, 1, 0.145067, -0.440975, -1, -0.235709, -0.46202, 1, -0.191366, -0.440975, -1, 0.235611, -0.46202, 1, 0.191269, -0.415818, -1, -0.2778, -0.440975, 1, -0.235709, -0.415818, -1, 0.277702, -0.440975, 1, 0.235611, -0.386551, -1, -0.317247, -0.415818, 1, -0.2778, -0.386551, -1, 0.31715, -0.415818, 1, 0.277702, -0.353563, -1, -0.353563, -0.386551, 1, -0.317247, -0.353563, -1, 0.353465, -0.386551, 1, 0.31715, -0.317247, -1, -0.386551, -0.353563, 1, -0.353563, -0.317247, -1, 0.386453, -0.353563, 1, 0.353465, -0.2778, -1, -0.415818, -0.317247, 1, -0.386551, -0.2778, -1, 0.41572, -0.317247, 1, 0.386453, -0.235709, -1, -0.440975, -0.2778, 1, -0.415818, -0.235709, -1, 0.440877, -0.2778, 1, 0.41572, -0.191366, -1, -0.46202, -0.235709, 1, -0.440975, -0.191366, -1, 0.461922, -0.235709, 1, 0.440877, -0.145164, -1, -0.478563, -0.191366, 1, -0.46202, -0.145164, -1, 0.478465, -0.191366, 1, 0.461922, -0.097592, -1, -0.490407, -0.145164, 1, -0.478563, -0.097592, -1, 0.490309, -0.145164, 1, 0.478465, -0.0490407, -1, -0.497651, -0.097592, 1, -0.490407, -0.0490407, -1, 0.497553, -0.097592, 1, 0.490309, 0, -1, -0.5, -0.0490407, 1, -0.497651, 0, -1, 0.5, -0.0490407, 1, 0.497553, 0.0489429, -1, -0.497651, 0, 1, -0.5, 0.0489429, -1, 0.497553, 0, 1, 0.5, 0.0974941, -1, -0.490407, 0.0489429, 1, -0.497651, 0.0974941, -1, 0.490309, 0.0489429, 1, 0.497553, 0.145067, -1, -0.478563, 0.0974941, 1, -0.490407, 0.145067, -1, 0.478465, 0.0974941, 1, 0.490309, 0.191269, -1, -0.46202, 0.145067, 1, -0.478563, 0.191269, -1, 0.461922, 0.145067, 1, 0.478465, 0.235611, -1, -0.440975, 0.191269, 1, -0.46202, 0.235611, -1, 0.440877, 0.191269, 1, 0.461922, 0.277702, -1, -0.415818, 0.235611, 1, -0.440975, 0.277702, -1, 0.41572, 0.235611, 1, 0.440877, 0.31715, -1, -0.386551, 0.277702, 1, -0.415818, 0.31715, -1, 0.386453, 0.277702, 1, 0.41572, 0.353465, -1, -0.353563, 0.31715, 1, -0.386551, 0.353465, -1, 0.353465, 0.31715, 1, 0.386453, 0.386453, -1, -0.317247, 0.353465, 1, -0.353563, 0.386453, -1, 0.31715, 0.353465, 1, 0.353465, 0.41572, -1, -0.2778, 0.386453, 1, -0.317247, 0.41572, -1, 0.277702, 0.386453, 1, 0.31715, 0.440877, -1, -0.235709, 0.41572, 1, -0.2778, 0.440877, -1, 0.235611, 0.41572, 1, 0.277702, 0.461922, -1, -0.191366, 0.440877, 1, -0.235709, 0.461922, -1, 0.191269, 0.440877, 1, 0.235611, 0.478465, -1, -0.145164, 0.461922, 1, -0.191366, 0.478465, -1, 0.145067, 0.461922, 1, 0.191269, 0.490309, -1, -0.097592, 0.478465, 1, -0.145164, 0.490309, -1, 0.0974941, 0.478465, 1, 0.145067, 0.497553, -1, -0.0490407, 0.490309, 1, -0.097592, 0.497553, -1, 0.0489429, 0.490309, 1, 0.0974941, 0.5, -1, 0, 0.497553, 1, -0.0490407, 0.497553, 1, 0.0489429, 0.5, 1, 0)
[sub_resource type="CylinderMesh" id="CylinderMesh_cy40f"]
[node name="Obstacle" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("ConvexPolygonShape3D_lapuk")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CylinderMesh_cy40f")
skeleton = NodePath("../..")

8
Assets/player_ship.gd Normal file
View File

@@ -0,0 +1,8 @@
extends RigidBody3D
@export var _start_direction: Vector3
@export var _start_speed: float
func _ready():
# apply_force(_, global_position)
apply_central_force(_start_direction.normalized() * _start_speed)

View File

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

49
Assets/player_ship.tscn Normal file
View File

@@ -0,0 +1,49 @@
[gd_scene load_steps=6 format=3 uid="uid://c8tm1q2cp567o"]
[ext_resource type="Script" uid="uid://ccnbhjxglgw12" path="res://Assets/player_ship.gd" id="1_3yydb"]
[ext_resource type="Script" uid="uid://ci33hs6nbuhqr" path="res://Assets/shipAiComponent.gd" id="2_vr0dq"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_tjnu1"]
radius = 1.48237
height = 3.89605
[sub_resource type="PrismMesh" id="PrismMesh_tjnu1"]
[sub_resource type="CylinderMesh" id="CylinderMesh_3yydb"]
[node name="PlayerShip" type="RigidBody3D"]
script = ExtResource("1_3yydb")
_start_direction = Vector3(0, 0, -50)
_start_speed = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, -0.358494)
shape = SubResource("CapsuleShape3D_tjnu1")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
transform = Transform3D(2.20781, 0, 0, 0, -9.18077e-08, -1.7005, 0, 2.10032, -7.43314e-08, 0, 0.524807, 0.378866)
mesh = SubResource("PrismMesh_tjnu1")
skeleton = NodePath("../..")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="CollisionShape3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.475193, -2.07714e-08)
mesh = SubResource("CylinderMesh_3yydb")
skeleton = NodePath("../..")
[node name="ShipAiComponent" type="Node" parent="."]
script = ExtResource("2_vr0dq")
metadata/_custom_type_script = "uid://ci33hs6nbuhqr"
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.32815, 0)
billboard = 2
no_depth_test = true
render_priority = 1
text = "Text"
font_size = 128
[node name="RayCast3D" type="RayCast3D" parent="."]
target_position = Vector3(0, 0, 0)
hit_from_inside = true
collide_with_areas = true
debug_shape_custom_color = Color(0.712962, 0.712962, 0.712962, 1)

40
Assets/shipAiComponent.gd Normal file
View File

@@ -0,0 +1,40 @@
extends Node
class_name ShipAiComponent
var text: Label3D
var colShape: CollisionShape3D
var distText = "Distance to collision: "
var secText = "Seconds to collision: "
var dist = 0.0
var collision = 0.0
func _ready():
text = $"../Label3D"
colShape = $"../CollisionShape3D"
func _physics_process(delta):
calcColDist(delta)
text.text = distText + String("%0.2f" % dist) + " Meters\n" + secText + String("%0.2f" % collision) + " Seconds"
func calcColDist(_delta) -> void:
var rigidBody: RigidBody3D = $".."
var rayCast: RayCast3D = $"../RayCast3D"
var pos = rigidBody.global_position
var linearVelocity = rigidBody.linear_velocity.normalized() * 100
rayCast.target_position = rigidBody.to_local(linearVelocity)
# rayCast.rotation = rigidBody.rotation
# rayCast.position = pos
if rayCast.is_colliding():
dist = (rayCast.get_collision_point() - pos).length() - 2.5 # Ship size-> eg. bounding box
collision = dist / rigidBody.linear_velocity.length()
if (collision <= 0.0):
collision = 0.0
else:
dist = 0.0
collision = 0.0

View File

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

31
Assets/thruster_cube.gd Normal file
View File

@@ -0,0 +1,31 @@
extends RigidBody3D
var torque_force: float = 10000.0
func _physics_process(delta):
var local_torque := Vector3.ZERO
# Pitch
if Input.is_action_pressed("w"):
local_torque.x -= 1
if Input.is_action_pressed("s"):
local_torque.x += 1
# Yaw
if Input.is_action_pressed("a"):
local_torque.y -= 1
if Input.is_action_pressed("d"):
local_torque.y += 1
# Roll
if Input.is_action_pressed("q"):
local_torque.z += 1
if Input.is_action_pressed("e"):
local_torque.z -= 1
# Apply local torque converted to world space
if local_torque != Vector3.ZERO:
var world_torque = global_transform.basis * local_torque.normalized() * torque_force * delta
apply_torque(world_torque)
print(angular_velocity)

View File

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

37
Assets/thruster_cube.tscn Normal file
View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=3 uid="uid://1al1ysn5q5yk"]
[ext_resource type="PackedScene" uid="uid://cmiwlha25agl4" path="res://Assets/Thruster Cube.glb" id="1_48yjx"]
[ext_resource type="Script" uid="uid://dd3ns5mckarbj" path="res://Assets/thruster_cube.gd" id="2_j3sme"]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_48yjx"]
points = PackedVector3Array(5.05799, 3.09144, 8.02469, 5.05799, -3.09243, 8.02469, 5.05799, 3.72121, 7.41253, 4.99561, 3.99253, 9.40488, 5.05799, -3.7222, 7.41253, 4.99561, -3.99352, 9.40488, 5.05799, 3.72121, -8.54888, 4.99561, 4.98769, 8.4087, 4.99165, 4.00936, 9.40714, 4.98769, 3.99253, 9.41165, 4.99165, 4.99165, 8.42677, 4.99561, -4.98868, 8.4087, 5.05799, -3.7222, -8.54888, 4.98769, -3.99352, 9.41165, 4.99165, -4.01035, 9.40714, 4.99165, -4.99264, 8.42677, 5.05799, 3.09144, -9.15878, 4.99561, 3.99253, -10.539, 4.99561, 4.98769, -9.54505, 1.20608, 0.951591, 11.8535, 4.00936, 4.99165, 9.40714, 4.98769, 4.99561, 8.4087, 3.99253, 4.99561, 9.40488, 4.99561, -4.98868, -9.54505, 4.99561, -3.99352, -10.539, 5.05799, -3.09243, -9.15878, 1.20608, -0.952582, 11.8535, 4.00936, -4.99264, 9.40714, 4.98769, -4.9966, 8.4087, 3.99253, -4.9966, 9.40488, 4.99165, 4.00936, -10.5435, 4.99165, 4.99165, -9.56086, 0.951591, 1.20608, 11.8535, 3.99253, 4.98769, 9.41165, 3.72121, 5.05799, 7.41253, 4.98769, 4.99561, -9.54505, -3.99352, 4.99561, 9.40488, 3.09144, 5.05799, 8.02469, 4.99165, -4.99264, -9.56086, 4.99165, -4.01035, -10.5435, 0.951591, -1.20707, 11.8535, 3.99253, -4.98868, 9.41165, 3.72121, -5.05799, 7.41253, 4.98769, -4.9966, -9.54505, -3.99352, -4.9966, 9.40488, 3.09144, -5.05799, 8.02469, 4.98769, 3.99253, -10.548, 3.08153, 3.08153, -11.2234, 4.00936, 4.99165, -10.5435, -0.952582, 1.20608, 11.8535, -3.99352, 4.98769, 9.41165, 3.72121, 5.05799, -8.54888, 3.99253, 4.99561, -10.539, -4.01035, 4.99165, 9.40714, -3.09243, 5.05799, 8.02469, -3.7222, 5.05799, 7.41253, -4.98868, 4.99561, 8.4087, -4.99264, 4.99165, 8.42677, 4.00936, -4.99264, -10.5435, 3.08153, -3.08252, -11.2234, 4.98769, -3.99352, -10.548, -0.952582, -1.20707, 11.8535, -3.99352, -4.98868, 9.41165, 3.72121, -5.05799, -8.54888, 3.99253, -4.9966, -10.539, -4.01035, -4.99264, 9.40714, -4.99264, -4.99264, 8.42677, -4.98868, -4.9966, 8.4087, -3.7222, -5.05799, 7.41253, -3.09243, -5.05799, 8.02469, 3.1152, 2.99935, -11.2234, 2.99935, 3.1152, -11.2234, 3.99253, 4.98769, -10.548, -1.20707, 0.951591, 11.8535, 3.09144, 5.05799, -9.15878, -3.99352, 4.99561, -10.539, -4.99264, 4.00936, 9.40714, -3.7222, 5.05799, -8.54888, -4.98868, 4.99561, -9.54505, -4.9966, 4.98769, 8.4087, -4.9966, 3.99253, 9.40488, 3.99253, -4.98868, -10.548, 2.99935, -3.11619, -11.2234, 3.1152, -3.00034, -11.2234, -1.20707, -0.952582, 11.8535, 3.09144, -5.05799, -9.15878, -3.99352, -4.9966, -10.539, -4.99264, -4.01035, 9.40714, -4.9966, -3.99352, 9.40488, -4.9966, -4.98868, 8.4087, -4.98868, -4.9966, -9.54505, -3.7222, -5.05799, -8.54888, -3.00034, 3.1152, -11.2234, -3.99352, 4.98769, -10.548, -4.98868, 3.99253, 9.41165, -3.09243, 5.05799, -9.15878, -4.01035, 4.99165, -10.5435, -4.99264, 4.99165, -9.56086, -5.05799, 3.72121, 7.41253, -4.9966, 4.98769, -9.54505, -5.05799, 3.09144, 8.02469, -3.99352, -4.98868, -10.548, -3.00034, -3.11619, -11.2234, -4.98868, -3.99352, 9.41165, -3.09243, -5.05799, -9.15878, -4.01035, -4.99264, -10.5435, -5.05799, -3.09243, 8.02469, -5.05799, -3.7222, 7.41253, -4.9966, -4.98868, -9.54505, -4.99264, -4.99264, -9.56086, -3.08252, 3.08153, -11.2234, -4.99264, 4.00936, -10.5435, -5.05799, 3.72121, -8.54888, -4.9966, 3.99253, -10.539, -3.08252, -3.08252, -11.2234, -4.99264, -4.01035, -10.5435, -5.05799, -3.7222, -8.54888, -4.9966, -3.99352, -10.539, -3.11619, 2.99935, -11.2234, -4.98868, 3.99253, -10.548, -5.05799, 3.09144, -9.15878, -3.11619, -3.00034, -11.2234, -4.98868, -3.99352, -10.548, -5.05799, -3.09243, -9.15878)
[node name="Thruster Cube" instance=ExtResource("1_48yjx")]
script = ExtResource("2_j3sme")
[node name="TheThrusterCube" parent="." index="0"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="1"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("ConvexPolygonShape3D_48yjx")
[node name="OmniLight3D" type="OmniLight3D" parent="." index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.84073, 4.87805, 10.3575)
light_color = Color(1, 0.231373, 0.360784, 1)
light_energy = 50.0
[node name="OmniLight3D2" type="OmniLight3D" parent="." index="3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.841, 4.878, -8.84974)
light_color = Color(1, 0.231373, 0.360784, 1)
light_energy = 50.0
[node name="OmniLight3D3" type="OmniLight3D" parent="." index="4"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.84073, -4.37604, 10.3575)
light_color = Color(1, 0.231373, 0.360784, 1)
light_energy = 50.0
[node name="OmniLight3D4" type="OmniLight3D" parent="." index="5"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.841, -4.3761, -8.84974)
light_color = Color(1, 0.231373, 0.360784, 1)
light_energy = 50.0

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://bp7um84bpvhmx"]
[ext_resource type="PackedScene" uid="uid://crfjfbhjuderh" path="res://Assets/Thruster Cube Collision.glb" id="1_v5i77"]
[node name="Thruster Cube Collision" instance=ExtResource("1_v5i77")]