Add godot-jolt, refactor BuildingBlockCreator

This commit is contained in:
Jens Pitkänen 2024-08-18 18:02:50 +03:00
parent 8820638e3e
commit 326ba481f8
33 changed files with 656 additions and 76 deletions

View File

@ -0,0 +1,18 @@
Copyright (c) Mikael Hermansson and Godot Jolt contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,91 @@
Godot Jolt incorporates third-party material from the projects listed below.
Godot Engine (https://github.com/godotengine/godot)
Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
godot-cpp (https://github.com/godot-jolt/godot-cpp)
Copyright (c) 2017-present Godot Engine contributors.
Copyright (c) 2022-present Mikael Hermansson.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Jolt Physics (https://github.com/godot-jolt/jolt)
Copyright (c) 2021 Jorrit Rouwe.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
mimalloc (https://github.com/godot-jolt/mimalloc)
Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,37 @@
[configuration]
entry_symbol = "godot_jolt_main"
compatibility_minimum = "4.3"
compatibility_maximum = "4.3"
[libraries]
windows.release.single.x86_64 = "windows/godot-jolt_windows-x64.dll"
windows.debug.single.x86_64 = "windows/godot-jolt_windows-x64_editor.dll"
windows.release.single.x86_32 = "windows/godot-jolt_windows-x86.dll"
windows.debug.single.x86_32 = "windows/godot-jolt_windows-x86_editor.dll"
linux.release.single.x86_64 = "linux/godot-jolt_linux-x64.so"
linux.debug.single.x86_64 = "linux/godot-jolt_linux-x64_editor.so"
linux.release.single.x86_32 = "linux/godot-jolt_linux-x86.so"
linux.debug.single.x86_32 = "linux/godot-jolt_linux-x86_editor.so"
macos.release.single = "macos/godot-jolt_macos.framework"
macos.debug.single = "macos/godot-jolt_macos_editor.framework"
ios.release.single = "ios/godot-jolt_ios.framework"
ios.debug.single = "ios/godot-jolt_ios_editor.framework"
android.release.single.arm64 = "android/libgodot-jolt_android-arm64.so"
android.debug.single.arm64 = "android/libgodot-jolt_android-arm64_editor.so"
android.release.single.arm32 = "android/libgodot-jolt_android-arm32.so"
android.debug.single.arm32 = "android/libgodot-jolt_android-arm32_editor.so"
android.release.single.x86_64 = "android/libgodot-jolt_android-x64.so"
android.debug.single.x86_64 = "android/libgodot-jolt_android-x64_editor.so"
android.release.single.x86_32 = "android/libgodot-jolt_android-x86.so"
android.debug.single.x86_32 = "android/libgodot-jolt_android-x86_editor.so"

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>godot-jolt_ios</string>
<key>CFBundleName</key>
<string>Godot Jolt</string>
<key>CFBundleDisplayName</key>
<string>Godot Jolt</string>
<key>CFBundleIdentifier</key>
<string>org.godot-jolt.godot-jolt</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Mikael Hermansson and Godot Jolt contributors.</string>
<key>CFBundleVersion</key>
<string>0.13.0</string>
<key>CFBundleShortVersionString</key>
<string>0.13.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<!--
HACK(mihe): This is to work around a bug in Godot 4.3-beta1, where it treats Framework
bundles the same as XCFramework bundles, and expects there to be an `AvailableLibraries`
entry, which is really only a thing in XCFramework bundles. Note that we also lie about the
binary path having a `.dylib` extension in order for Godot to correctly identify this as a
dynamically linked bundle.
-->
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>godot-jolt_ios.dylib</string>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>godot-jolt_ios_editor</string>
<key>CFBundleName</key>
<string>Godot Jolt</string>
<key>CFBundleDisplayName</key>
<string>Godot Jolt</string>
<key>CFBundleIdentifier</key>
<string>org.godot-jolt.godot-jolt</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Mikael Hermansson and Godot Jolt contributors.</string>
<key>CFBundleVersion</key>
<string>0.13.0</string>
<key>CFBundleShortVersionString</key>
<string>0.13.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<!--
HACK(mihe): This is to work around a bug in Godot 4.3-beta1, where it treats Framework
bundles the same as XCFramework bundles, and expects there to be an `AvailableLibraries`
entry, which is really only a thing in XCFramework bundles. Note that we also lie about the
binary path having a `.dylib` extension in order for Godot to correctly identify this as a
dynamically linked bundle.
-->
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>godot-jolt_ios_editor.dylib</string>
</dict>
</array>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>godot-jolt_macos</string>
<key>CFBundleName</key>
<string>Godot Jolt</string>
<key>CFBundleDisplayName</key>
<string>Godot Jolt</string>
<key>CFBundleIdentifier</key>
<string>org.godot-jolt.godot-jolt</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Mikael Hermansson and Godot Jolt contributors.</string>
<key>CFBundleVersion</key>
<string>0.13.0</string>
<key>CFBundleShortVersionString</key>
<string>0.13.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTPlatformName</key>
<string>macosx</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
</dict>
</plist>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
+hmuH+erxzRxY/FPATmWbEaqOys=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
WsqyDktXR1oDgMLbvIUu+PMJsJAnbBKIUYnKgafFEGc=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>godot-jolt_macos_editor</string>
<key>CFBundleName</key>
<string>Godot Jolt</string>
<key>CFBundleDisplayName</key>
<string>Godot Jolt</string>
<key>CFBundleIdentifier</key>
<string>org.godot-jolt.godot-jolt</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Mikael Hermansson and Godot Jolt contributors.</string>
<key>CFBundleVersion</key>
<string>0.13.0</string>
<key>CFBundleShortVersionString</key>
<string>0.13.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTPlatformName</key>
<string>macosx</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
</dict>
</plist>

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
GsvlA3T0mwbtJS37DcxlHyr4Vro=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
4Rs/lwMrLlMFf5H+0QtaW/gUNP59U2nHlU4LBmarG1Q=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=113 format=4 uid="uid://8po7ftboqq4k"] [gd_scene load_steps=112 format=4 uid="uid://8po7ftboqq4k"]
[ext_resource type="CameraAttributesPhysical" uid="uid://cxyj2tvfksjl6" path="res://maps/hazy_env_camera_attrs.tres" id="1_r2j1d"] [ext_resource type="CameraAttributesPhysical" uid="uid://cxyj2tvfksjl6" path="res://maps/hazy_env_camera_attrs.tres" id="1_r2j1d"]
[ext_resource type="LightmapGIData" uid="uid://bp05p4yab2ukx" path="res://maps/demo.lmbake" id="2_2ehlo"] [ext_resource type="LightmapGIData" uid="uid://bp05p4yab2ukx" path="res://maps/demo.lmbake" id="2_2ehlo"]
@ -649,11 +649,8 @@ points = PackedVector3Array(-15.2154, 16, 3.21429, 0.784632, -16, -12.7857, 2.78
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_i1n6v"] [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_i1n6v"]
points = PackedVector3Array(-3.21348, 16, 13.2143, 12.7865, -16, -2.78572, 15.7846, -16, -2.78571, -0.21537, 16, 13.2143, -3.21348, 16, 15.2143, 12.7865, -16, -0.785713, 15.7846, -16, -0.785711, -0.215368, 16, 15.2143) points = PackedVector3Array(-3.21348, 16, 13.2143, 12.7865, -16, -2.78572, 15.7846, -16, -2.78571, -0.21537, 16, 13.2143, -3.21348, 16, 15.2143, 12.7865, -16, -0.785713, 15.7846, -16, -0.785711, -0.215368, 16, 15.2143)
[sub_resource type="SphereShape3D" id="SphereShape3D_pxxc6"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_rgktv"]
radius = 0.3 height = 1.9
[sub_resource type="CylinderShape3D" id="CylinderShape3D_cnaby"]
height = 0.6
radius = 0.3 radius = 0.3
[node name="Demo" type="Node3D"] [node name="Demo" type="Node3D"]
@ -1027,7 +1024,7 @@ shape = SubResource("ConvexPolygonShape3D_ldbum")
shape = SubResource("ConvexPolygonShape3D_i1n6v") shape = SubResource("ConvexPolygonShape3D_i1n6v")
[node name="BuildingBlockCreator" parent="." node_paths=PackedStringArray("TrenchbroomMap") instance=ExtResource("9_w4r35")] [node name="BuildingBlockCreator" parent="." node_paths=PackedStringArray("TrenchbroomMap") instance=ExtResource("9_w4r35")]
transform = Transform3D(0.10442, 0, 0, 0, 0.10442, 0, 0, 0, 0.10442, 0, 2, -3) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -7.84902)
TrenchbroomMap = NodePath("../FuncGodotMap") TrenchbroomMap = NodePath("../FuncGodotMap")
[node name="ReflectionProbes" type="Node3D" parent="."] [node name="ReflectionProbes" type="Node3D" parent="."]
@ -1060,20 +1057,13 @@ size = Vector3(87.9724, 96.1174, 91.8458)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0415039, 58.3319, 0.0198975) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0415039, 58.3319, 0.0198975)
size = Vector3(43.3174, 26.5295, 43.4319) size = Vector3(43.3174, 26.5295, 43.4319)
[node name="Player" type="RigidBody3D" parent="." node_paths=PackedStringArray("GroundCast")] [node name="Player" type="CharacterBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.05117, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.51124, 0)
axis_lock_angular_x = true
axis_lock_angular_z = true
can_sleep = false
script = ExtResource("10_87t4r") script = ExtResource("10_87t4r")
GroundCast = NodePath("GroundCast")
UprightingSpeed = 10.0
[node name="CoreBody" type="CollisionShape3D" parent="Player"]
shape = SubResource("SphereShape3D_pxxc6")
[node name="PlayerEyeCamera" type="Camera3D" parent="Player"] [node name="PlayerEyeCamera" type="Camera3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.7, 0)
[node name="GroundCast" type="ShapeCast3D" parent="Player"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
shape = SubResource("CylinderShape3D_cnaby") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.95, 0)
target_position = Vector3(0, -1.3, 0) shape = SubResource("CylinderShape3D_rgktv")

View File

@ -15,6 +15,11 @@ run/main_scene="res://maps/demo.tscn"
config/features=PackedStringArray("4.3", "C#", "Forward Plus") config/features=PackedStringArray("4.3", "C#", "Forward Plus")
config/icon="res://misc/icon.svg" config/icon="res://misc/icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
[dotnet] [dotnet]
project/assembly_name="gmtk24" project/assembly_name="gmtk24"
@ -85,6 +90,14 @@ jump={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
] ]
} }
sprint={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
]
}
[internationalization] [internationalization]
@ -92,8 +105,8 @@ rendering/positional_shadow/atlas_quadrant_0_subdiv=2
[physics] [physics]
3d/run_on_separate_thread=true
common/physics_ticks_per_second=120 common/physics_ticks_per_second=120
3d/physics_engine="JoltPhysics3D"
3d/default_gravity=15.0 3d/default_gravity=15.0
[rendering] [rendering]

View File

@ -10,29 +10,22 @@ namespace Gmtk24 {
public PackedScene BuildingBlockPrefab; public PackedScene BuildingBlockPrefab;
[Export] [Export]
public ShaderMaterial BuildingBlockMaterial; public ShaderMaterial BuildingBlockMaterial;
[Export]
public float BuildingBlockScale = 0.05f;
public override void _Ready() { public override void _Ready() {
var scale = 0.05f;
var children = TrenchbroomMap.FindChildren("*_buildingblock"); var children = TrenchbroomMap.FindChildren("*_buildingblock");
foreach (var buildingBlockStaticBody in children) { foreach (var buildingBlockStaticBody in children) {
var buildingBlock = BuildingBlockPrefab.Instantiate(); var buildingBlock = BuildingBlockPrefab.Instantiate();
var smallMesh = new MeshInstance3D { var smallMesh = (MeshInstance3D)buildingBlockStaticBody.GetChild<MeshInstance3D>(0).Duplicate();
Mesh = buildingBlockStaticBody.GetChild<MeshInstance3D>(0).Mesh, smallMesh.Scale = Vector3.One * BuildingBlockScale;
Scale = Vector3.One * scale,
};
for (int i = 0; i < smallMesh.GetSurfaceOverrideMaterialCount(); i++) { for (int i = 0; i < smallMesh.GetSurfaceOverrideMaterialCount(); i++) {
var replacedMaterial = smallMesh.Mesh.SurfaceGetMaterial(i); var replacedMaterial = smallMesh.Mesh.SurfaceGetMaterial(i);
var transparency = replacedMaterial.Get("transparency"); var transparency = replacedMaterial.Get("transparency");
if (((int)transparency) != 0) { if (((int)transparency) != 0) {
// Make a new material, using the partly-transparent albedo as an alpha mask // Make a new material, using the partly-transparent albedo as an alpha mask
var blockMaterialWithAlphaMask = new ShaderMaterial { var blockMaterialWithAlphaMask = (ShaderMaterial)BuildingBlockMaterial.Duplicate();
Shader = BuildingBlockMaterial.Shader,
};
foreach (var uniform in BuildingBlockMaterial.Shader.GetShaderUniformList()) {
var uniformName = (StringName)((Dictionary)uniform).GetValueOrDefault("name");
blockMaterialWithAlphaMask.SetShaderParameter(uniformName, BuildingBlockMaterial.GetShaderParameter(uniformName));
}
blockMaterialWithAlphaMask.SetShaderParameter("texture_albedo_for_alpha", replacedMaterial.Get("albedo_texture")); blockMaterialWithAlphaMask.SetShaderParameter("texture_albedo_for_alpha", replacedMaterial.Get("albedo_texture"));
smallMesh.SetSurfaceOverrideMaterial(i, blockMaterialWithAlphaMask); smallMesh.SetSurfaceOverrideMaterial(i, blockMaterialWithAlphaMask);
} else { } else {
@ -43,16 +36,14 @@ namespace Gmtk24 {
var collisionShapes = buildingBlockStaticBody.FindChildren("*_collision_shape"); var collisionShapes = buildingBlockStaticBody.FindChildren("*_collision_shape");
foreach (var shape in collisionShapes) { foreach (var shape in collisionShapes) {
var bigPoints = ((ConvexPolygonShape3D)((CollisionShape3D)shape).Shape).Points; CollisionShape3D newShape = (CollisionShape3D)shape.Duplicate();
var bigPoints = ((ConvexPolygonShape3D)newShape.Shape).Points;
var points = new Vector3[bigPoints.Length]; var points = new Vector3[bigPoints.Length];
for (int i = 0; i < bigPoints.Length; i++) { for (int i = 0; i < bigPoints.Length; i++) {
points[i] = bigPoints[i] * scale; points[i] = bigPoints[i] * BuildingBlockScale;
} }
buildingBlock.AddChild(new CollisionShape3D { ((ConvexPolygonShape3D)newShape.Shape).Points = points;
Shape = new ConvexPolygonShape3D { buildingBlock.AddChild(newShape);
Points = points,
},
});
} }
AddChild(buildingBlock); AddChild(buildingBlock);

View File

@ -1,48 +1,58 @@
using Godot; using Godot;
namespace Gmtk24 { namespace Gmtk24 {
public partial class Player : RigidBody3D { public partial class Player : CharacterBody3D {
[Export]
public ShapeCast3D GroundCast;
[Export]
public float UprightingSpeed = 1;
[Export] [Export]
public float MovementSpeed = 7; public float MovementSpeed = 7;
[Export] [Export]
public bool PhysicsControlled = false; public float SprintMultiplier = 1.5f;
[Export]
public Node3D Eye;
private float CurrentPitch = 0;
public override void _Ready() {
// Input.MouseMode = Input.MouseModeEnum.Captured;
}
public override void _Input(InputEvent @event) {
if (@event is InputEventMouseMotion ev && Input.MouseMode == Input.MouseModeEnum.Captured) {
var cameraSensitivityX = 3f; // FIXME: use camera sensitivity and invert settings
var cameraSensitivityY = 3f; // FIXME: use camera sensitivity and invert settings
Eye.RotateY(ev.Relative.X * 0.01f * cameraSensitivityX);
CurrentPitch += ev.Relative.Y * 0.01f * cameraSensitivityY;
}
}
public override void _Process(double delta) {
var yawInput = Input.GetActionStrength("look_left") - Input.GetActionStrength("look_right");
var pitchInput = Input.GetActionStrength("look_up") - Input.GetActionStrength("look_down");
var cameraSensitivityX = 3f; // FIXME: use camera sensitivity and invert settings
var cameraSensitivityY = 3f; // FIXME: use camera sensitivity and invert settings
Eye.RotateY(yawInput * cameraSensitivityX * (float)delta);
if (Eye != null) {
CurrentPitch += pitchInput * cameraSensitivityY * (float)delta;
CurrentPitch = Mathf.Clamp(CurrentPitch, -Mathf.Pi / 2, Mathf.Pi / 2);
Eye.Quaternion = new Quaternion(Vector3.Right, CurrentPitch);
}
}
public override void _PhysicsProcess(double delta) { public override void _PhysicsProcess(double delta) {
if (PhysicsControlled) { Vector3 moveInput = new Vector3(
CustomIntegrator = false; Input.GetActionStrength("move_right") - Input.GetActionStrength("move_left"), 0,
} else { Input.GetActionStrength("move_backward") - Input.GetActionStrength("move_forward")
// Disable physics movement );
CustomIntegrator = true; Vector3 move = Eye.Basis * moveInput;
LinearVelocity = Vector3.Zero; move = move.Normalized() * Mathf.Min(1, move.Length()) * MovementSpeed;
AngularVelocity = Vector3.Zero; if (Input.IsActionPressed("sprint")) {
move *= SprintMultiplier;
Vector3 pos = Position;
// Move up enough to no longer have the groundcast hit
if (GroundCast.IsColliding()) {
float distanceToUpright = 0;
for (int i = 0; i < GroundCast.GetCollisionCount(); i++) {
distanceToUpright = Mathf.Max(distanceToUpright, (GroundCast.GetCollisionPoint(i) - GroundCast.TargetPosition).Length());
}
float step = Mathf.Min(distanceToUpright, UprightingSpeed * (float)delta);
pos.Y += step;
} else {
pos.Y += GetGravity().Y * (float)delta;
}
// On-ground movement
float zMoveInput = Input.GetActionStrength("move_backward") - Input.GetActionStrength("move_forward");
float xMoveInput = Input.GetActionStrength("move_right") - Input.GetActionStrength("move_left");
Vector3 moveInput = new Vector3(xMoveInput, 0, zMoveInput) * Basis;
moveInput = moveInput.Normalized() * Mathf.Min(1, moveInput.Length());
pos += moveInput * MovementSpeed * (float)delta;
Position = pos;
} }
Vector3 vel = Velocity;
vel.X = move.X;
vel.Z = move.Z;
vel += GetGravity() * (float)delta;
Velocity = vel;
MoveAndSlide();
} }
} }
} }