added a 3d spinning cube 2d tile

This commit is contained in:
2023-02-13 14:02:52 +01:00
parent e584ee67c1
commit 9c95c2d7b7
6 changed files with 212 additions and 144 deletions

30
scenes/3D/3d_cube.tscn Normal file
View File

@@ -0,0 +1,30 @@
[gd_scene load_steps=4 format=3 uid="uid://boxvq5qowh8nn"]
[sub_resource type="Environment" id="Environment_t32a1"]
[sub_resource type="BoxMesh" id="BoxMesh_5dg07"]
[sub_resource type="GDScript" id="GDScript_a7mr5"]
resource_name = "spinning"
script/source = "extends MeshInstance3D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
rotate_y(0.01)
rotate_z(0.01)
"
[node name="Node3D" type="WorldEnvironment"]
environment = SubResource("Environment_t32a1")
[node name="mesh_instance_3d" type="MeshInstance3D" parent="."]
transform = Transform3D(0.5, -0.5, 0.707107, 0.707107, 0.707107, 0, -0.5, 0.5, 0.707107, 0, 0, 0)
mesh = SubResource("BoxMesh_5dg07")
script = SubResource("GDScript_a7mr5")
[node name="camera_3d" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.982906, 0.184106, 0, -0.184106, 0.982906, 0, 0.303103, 2.61621)
fov = 99.1704
[node name="directional_light_3d" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.856547, 0.51607, 0, -0.51607, 0.856547, 0, 0, 5.56892)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,30 @@
[gd_scene load_steps=3 format=3 uid="uid://dxfg62cl12ppw"]
[ext_resource type="PackedScene" uid="uid://boxvq5qowh8nn" path="res://scenes/3D/3d_cube.tscn" id="1_643fx"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lxe27"]
size = Vector2(64, 64)
[node name="3d_cube_tile" type="Node2D"]
[node name="static_body_2d" type="StaticBody2D" parent="."]
position = Vector2(0, 1)
[node name="collision_shape_2d" type="CollisionShape2D" parent="static_body_2d"]
position = Vector2(1, -2)
shape = SubResource("RectangleShape2D_lxe27")
[node name="sub_viewport_container" type="SubViewportContainer" parent="."]
offset_left = -115.0
offset_top = -112.0
offset_right = 141.0
offset_bottom = 144.0
[node name="sub_viewport" type="SubViewport" parent="sub_viewport_container"]
own_world_3d = true
transparent_bg = true
handle_input_locally = false
size = Vector2i(230, 230)
render_target_update_mode = 4
[node name="Node3D" parent="sub_viewport_container/sub_viewport" instance=ExtResource("1_643fx")]