-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace2.tscn
97 lines (78 loc) · 2.82 KB
/
space2.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[gd_scene load_steps=8 format=3 uid="uid://dqt017vn5oo7u"]
[ext_resource type="Script" path="res://camera.gd" id="1_wnfu1"]
[ext_resource type="Script" path="res://3d-grid.gd" id="3_ghjq6"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_uokmo"]
albedo_color = Color(0.882353, 0.552941, 0.403922, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m83q3"]
albedo_color = Color(0.780392, 0.301961, 0.141176, 1)
[sub_resource type="GDScript" id="GDScript_1sb1k"]
script/source = "extends CSGSphere3D
var gravity = 6.6743 * pow(10,-11)
@export var mass = 0.0
var velocity = Vector3.ZERO
@export var sun = false
func _ready():
if sun:
$OmniLight3D.light_energy = 10
func _process(delta):
velocity += acceleration()
position += velocity
func acceleration():
var acceleration = Vector3.ZERO
for body in get_parent().get_children():
if body.is_in_group(\"physics\"):
if body != self:
var acc = calc_gravity(body.mass, body.position)/mass
acceleration += acc
return acceleration
func calc_gravity(m, position):
var distance = position.distance_squared_to(position)
var force = gravity * (mass * m / distance)
var vector = (position - position).normalized()
force *= vector
return force
"
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f0nm1"]
emission_enabled = true
emission = Color(0.713726, 0.380392, 0.137255, 1)
emission_energy_multiplier = 2.25
[sub_resource type="Environment" id="Environment_5uoid"]
background_mode = 1
ambient_light_source = 2
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_energy = 0.01
[node name="Node3D" type="Node3D"]
[node name="Jupiter" type="CSGSphere3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.1168, 0, 0)
visible = false
radius = 1.409
radial_segments = 54
rings = 31
material = SubResource("StandardMaterial3D_uokmo")
[node name="Mars" type="CSGSphere3D" parent="." groups=["physics"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.54252, 0, -0.565593)
visible = false
radial_segments = 32
rings = 12
material = SubResource("StandardMaterial3D_m83q3")
script = SubResource("GDScript_1sb1k")
mass = 200.0
[node name="Sun" type="CSGSphere3D" parent="."]
radial_segments = 64
rings = 16
material = SubResource("StandardMaterial3D_f0nm1")
[node name="OmniLight3D" type="OmniLight3D" parent="Sun"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00645733, 0, 0)
light_energy = 16.0
shadow_enabled = true
omni_range = 337.758
omni_attenuation = 0.63728
omni_shadow_mode = 0
[node name="Node3D" type="Node3D" parent="."]
script = ExtResource("3_ghjq6")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_5uoid")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.47194, 15.5687)
fov = 82.8
script = ExtResource("1_wnfu1")