generated from godotengine/godot-cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/3d #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/3d #4
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6fd9ab7
feat: add 3d scene
himanusia e90ce81
feat: load car gui
himanusia 1c684a5
fix: input
himanusia 0aebe4f
feat: add animation
himanusia 9d1e268
Merge branch 'main' into pr/aibrahim185/4
himanusia ce97285
feat: disable buttons on reset and enable after loading file
himanusia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| 5 5 | ||
| 5 | ||
| EAAA. | ||
| ED.PB | ||
| .D.PB | ||
| .DCCB | ||
| ..... | ||
| K |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| [gd_scene load_steps=4 format=3 uid="uid://bj1kkdl8im8kb"] | ||
|
|
||
| [ext_resource type="Material" uid="uid://6hu2nb8ajcvx" path="res://scenes/non_primary_material.tres" id="1_2fv4s"] | ||
| [ext_resource type="Material" uid="uid://dyl801edovtaw" path="res://scenes/wheel_material.tres" id="1_je4r3"] | ||
|
|
||
| [sub_resource type="BoxShape3D" id="BoxShape3D_rc6gd"] | ||
| size = Vector3(0.8, 0.8, 1.8) | ||
|
|
||
| [node name="Car2" type="RigidBody3D"] | ||
| transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.9, 0, 0.4) | ||
|
|
||
| [node name="Body" type="CSGBox3D" parent="."] | ||
| size = Vector3(0.7, 0.5, 1.8) | ||
| material = ExtResource("1_2fv4s") | ||
|
|
||
| [node name="Wheel" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -0.3, -0.2, -0.5) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_je4r3") | ||
|
|
||
| [node name="Wheel2" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(1.31134e-07, 1, 0, -1, 1.31134e-07, 0, 0, 0, 1, 0.3, -0.2, -0.5) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_je4r3") | ||
|
|
||
| [node name="Wheel3" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -0.3, -0.2, 0.5) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_je4r3") | ||
|
|
||
| [node name="Wheel4" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0.3, -0.2, 0.5) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_je4r3") | ||
|
|
||
| [node name="CollisionShape3D" type="CollisionShape3D" parent="."] | ||
| shape = SubResource("BoxShape3D_rc6gd") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| [gd_scene load_steps=4 format=3 uid="uid://nk8hrlhom63t"] | ||
|
|
||
| [ext_resource type="Material" uid="uid://c0xrqwe2nwfyy" path="res://scenes/primary_material.tres" id="1_1b0sv"] | ||
| [ext_resource type="Material" uid="uid://dyl801edovtaw" path="res://scenes/wheel_material.tres" id="1_6a10o"] | ||
|
|
||
| [sub_resource type="BoxShape3D" id="BoxShape3D_hnjk1"] | ||
| size = Vector3(0.8, 0.8, 2.8) | ||
|
|
||
| [node name="Car3" type="RigidBody3D"] | ||
| transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 1.4, 0, 0.4) | ||
|
|
||
| [node name="Body" type="CSGBox3D" parent="."] | ||
| size = Vector3(0.7, 0.6, 2.8) | ||
| material = ExtResource("1_1b0sv") | ||
|
|
||
| [node name="Wheel" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -0.3, -0.2, -0.9) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_6a10o") | ||
|
|
||
| [node name="Wheel2" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(1.31134e-07, 1, 0, -1, 1.31134e-07, 0, 0, 0, 1, 0.3, -0.2, -0.9) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_6a10o") | ||
|
|
||
| [node name="Wheel3" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -0.3, -0.2, 0.8) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_6a10o") | ||
|
|
||
| [node name="Wheel4" type="CSGCylinder3D" parent="Body"] | ||
| transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0.3, -0.2, 0.8) | ||
| radius = 0.2 | ||
| height = 0.2 | ||
| material = ExtResource("1_6a10o") | ||
|
|
||
| [node name="CollisionShape3D" type="CollisionShape3D" parent="."] | ||
| shape = SubResource("BoxShape3D_hnjk1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| shader_type spatial; | ||
|
|
||
| uniform vec4 base_color : source_color = vec4(0.8, 0.8, 0.8, 1.0); | ||
| uniform vec4 line_color : source_color = vec4(0.0, 0.0, 0.0, 1.0); | ||
| uniform float grid_spacing = 1.0; | ||
| uniform float line_thickness = 0.1; | ||
| uniform vec2 mesh_actual_size; | ||
| uniform int grid_plane = 1; | ||
|
|
||
| varying vec3 v_local_position; | ||
|
|
||
| void vertex() { | ||
| v_local_position = VERTEX; | ||
| } | ||
|
|
||
| void fragment() { | ||
| vec2 coord_on_plane; | ||
|
|
||
| if (grid_plane == 1) { | ||
| coord_on_plane = v_local_position.xz; | ||
| } else if (grid_plane == 0) { | ||
| coord_on_plane = v_local_position.xy; | ||
| } else { | ||
| coord_on_plane = v_local_position.yz; | ||
| } | ||
|
|
||
| vec2 shifted_coord = coord_on_plane + mesh_actual_size / 2.0; | ||
| float half_thick = line_thickness / 2.0; | ||
|
|
||
| float mod_val_x = mod(shifted_coord.x, grid_spacing); | ||
| bool on_vertical_line = (mod_val_x < half_thick || mod_val_x > grid_spacing - half_thick); | ||
|
|
||
| if (abs(shifted_coord.x - mesh_actual_size.x) < half_thick && mesh_actual_size.x > 0.001) { | ||
| on_vertical_line = true; | ||
| } | ||
|
|
||
| float mod_val_y = mod(shifted_coord.y, grid_spacing); | ||
| bool on_horizontal_line = (mod_val_y < half_thick || mod_val_y > grid_spacing - half_thick); | ||
|
|
||
| if (abs(shifted_coord.y - mesh_actual_size.y) < half_thick && mesh_actual_size.y > 0.001) { | ||
| on_horizontal_line = true; | ||
| } | ||
|
|
||
| if (on_vertical_line || on_horizontal_line) { | ||
| ALBEDO = line_color.rgb; | ||
| ALPHA = line_color.a; | ||
| } else { | ||
| ALBEDO = base_color.rgb; | ||
| ALPHA = base_color.a; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://dif4yb3527o0r |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to document the expected values for 'grid_plane' (e.g., 0, 1, and any other value representing the YZ plane) to improve clarity for future maintainers.