Add multiplayer damage system and ragdolls

This commit is contained in:
Nikolai Rodionov 2025-01-26 14:39:11 +01:00
parent 7da4a3d6bb
commit 06a1d28e42
Signed by: allanger
GPG Key ID: 09F8B434D0FDD99B
53 changed files with 3969 additions and 61 deletions

18
godot-jolt/LICENSE.txt Normal file
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.

91
godot-jolt/THIRDPARTY.txt Normal file
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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,41 @@
[godot-jolt]
version = "0.14.0-stable"
build = "3392156fab"
[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.14.0</string>
<key>CFBundleShortVersionString</key>
<string>0.14.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>

Binary file not shown.

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.14.0</string>
<key>CFBundleShortVersionString</key>
<string>0.14.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.14.0</string>
<key>CFBundleShortVersionString</key>
<string>0.14.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>
et0C7sxAlu4eIDcq2ihFQ2BhDSk=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
ZnG0hD4DciikOVWrf1Ai1Qedz9hESuIFvUujZAebHRY=
</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.14.0</string>
<key>CFBundleShortVersionString</key>
<string>0.14.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>
oIAzxlQz4Hun6JnLVOu9jafYxGE=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
FA6I/u5+Ww0DzXAvawYXs792eum+8Bim8uHBbg98jqY=
</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.

Binary file not shown.

Binary file not shown.

View File

@ -13,6 +13,7 @@ config_version=5
config/name="Open Strike"
run/main_scene="res://scenes/utils/Menu.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
run/max_fps=120
config/icon="res://icon.svg"
[autoload]
@ -25,6 +26,7 @@ window/size/viewport_width=1920
window/size/viewport_height=1964
window/size/mode=4
window/size/borderless=true
window/vsync/vsync_mode=2
[filesystem]
@ -34,6 +36,7 @@ import/blender/enabled=false
body=""
target=""
player_placeholder=""
[input]
@ -90,6 +93,7 @@ crouch={
[physics]
3d/physics_engine="JoltPhysics3D"
3d/default_gravity=15.0
[rendering]

View File

@ -1,8 +1,11 @@
extends Node3D
var owner_placeholder: CharacterBody3D = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Body/Armature/Skeleton3D.physical_bones_start_simulation()
owner_placeholder = _get_owner()
pass # Replace with function body.
@ -12,5 +15,27 @@ func _process(delta: float) -> void:
func _on_head_collision_body_part_hit(dam: Variant) -> void:
print("head is hit")
#print("head is hit" + str(dam))
#print(owner_placeholder)
#if owner_placeholder.has_method("take_damage"):
if owner_placeholder:
owner_placeholder.take_damage(dam)
pass # Replace with function body.
func _get_owner() -> CharacterBody3D:
var owner_placeholder := find_parent("PlayerPlaceholder*")
return owner_placeholder
func die():
for child in $Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.get_children():
if child is PhysicalBone3D:
child.collision_layer = 1
child.collision_mask = 1
$Body/Armature/Skeleton3D.physical_bones_stop_simulation()
$Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.physical_bones_start_simulation()
func make_invisible():
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(1, false)
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(1, false)
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(2, true)
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(2, true)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=4 uid="uid://1txob6jskn5s"]
[gd_scene load_steps=28 format=4 uid="uid://1txob6jskn5s"]
[ext_resource type="Script" path="res://scenes/characters/blue/dummy.gd" id="1_cyeub"]
[ext_resource type="Script" path="res://scenes/characters/blue/head_collision.gd" id="1_lianf"]
@ -258,9 +258,70 @@ blend_shape_mode = 0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j3emx"]
albedo_color = Color(0, 0, 1, 1)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_k5bjr"]
radius = 11.245
height = 27.8
[sub_resource type="SphereShape3D" id="SphereShape3D_axep3"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_0ptuo"]
radius = 11.7055
height = 28.953
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_126jt"]
radius = 3.944
height = 12.926
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1gw5y"]
radius = 10.779
height = 24.58
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_krlof"]
radius = 2.74047
height = 27.4047
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2k34c"]
radius = 2.76145
height = 27.6145
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_5fgdh"]
radius = 5.286
height = 20.647
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_8vkyv"]
radius = 2.74047
height = 27.4047
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_fh1k4"]
radius = 2.76144
height = 27.6144
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1m8r5"]
radius = 5.286
height = 20.647
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3cygo"]
radius = 4.05994
height = 40.5994
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_vwdij"]
radius = 4.2099
height = 42.099
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_qyg6j"]
radius = 1.57216
height = 15.7216
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_a81km"]
radius = 4.05995
height = 40.5995
[sub_resource type="CylinderShape3D" id="CylinderShape3D_2binp"]
height = 42.0
radius = 3.0
[sub_resource type="CylinderShape3D" id="CylinderShape3D_l2il6"]
height = 27.0
radius = 1.75
[sub_resource type="SphereShape3D" id="SphereShape3D_wnhib"]
radius = 1.2
[sub_resource type="Animation" id="Animation_6g1lc"]
resource_name = "Run Forward"
@ -867,7 +928,7 @@ _data = {
}
[node name="Dummy" type="Node3D"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0)
script = ExtResource("1_cyeub")
[node name="Body" type="Node3D" parent="."]
@ -1048,7 +1109,7 @@ bones/24/name = "mixamorig_LeftHandRing2"
bones/24/parent = 23
bones/24/rest = Transform3D(1, 1.61871e-05, -9.45085e-08, -1.61871e-05, 1, 3.29224e-06, 9.45618e-08, -3.29224e-06, 1, 6.3543e-07, 3.60118, -1.47875e-05)
bones/24/enabled = true
bones/24/position = Vector3(-3.30613e-06, 3.60119, 1.50863e-07)
bones/24/position = Vector3(-3.30613e-06, 3.60119, 1.50864e-07)
bones/24/rotation = Quaternion(0.563924, -3.30111e-07, -0.0577891, 0.823803)
bones/24/scale = Vector3(1, 1, 1)
bones/25/name = "mixamorig_LeftHandRing3"
@ -1077,7 +1138,7 @@ bones/28/parent = 27
bones/28/rest = Transform3D(1, 0.000736602, -7.57697e-07, -0.000736602, 1, 9.24707e-06, 7.64508e-07, -9.24651e-06, 1, 1.0844e-06, 4.13666, 1.41886e-05)
bones/28/enabled = true
bones/28/position = Vector3(-9.08385e-06, 4.13665, 5.47372e-06)
bones/28/rotation = Quaternion(0.433129, -6.53828e-07, -0.0443853, 0.900239)
bones/28/rotation = Quaternion(0.433129, -6.53827e-07, -0.0443853, 0.900239)
bones/28/scale = Vector3(1, 1, 1)
bones/29/name = "mixamorig_LeftHandPinky3"
bones/29/parent = 28
@ -1126,7 +1187,7 @@ bones/35/parent = 34
bones/35/rest = Transform3D(0.894428, 0.447212, -8.12113e-07, -0.387297, 0.774597, -0.500001, -0.223606, 0.447215, 0.866025, 3.00297, 3.7888, 2.16716)
bones/35/enabled = true
bones/35/position = Vector3(3.00297, 3.7888, 2.16716)
bones/35/rotation = Quaternion(0.227577, -0.0598799, -0.162411, 0.958252)
bones/35/rotation = Quaternion(0.227577, -0.0598799, -0.162411, 0.958251)
bones/35/scale = Vector3(1, 1, 1)
bones/36/name = "mixamorig_RightHandThumb2"
bones/36/parent = 35
@ -1210,14 +1271,14 @@ bones/47/parent = 34
bones/47/rest = Transform3D(1, 9.66599e-06, -1.40744e-07, -9.66599e-06, 1, -2.81994e-06, 1.40717e-07, 2.81994e-06, 1, -2.21663, 12.147, -0.00999829)
bones/47/enabled = true
bones/47/position = Vector3(-2.21664, 12.147, -0.00998812)
bones/47/rotation = Quaternion(0.0911117, 0.11369, 0.100504, 0.984211)
bones/47/rotation = Quaternion(0.0911117, 0.11369, 0.100504, 0.984212)
bones/47/scale = Vector3(1, 1, 1)
bones/48/name = "mixamorig_RightHandRing2"
bones/48/parent = 47
bones/48/rest = Transform3D(1, -1.60845e-05, 3.26056e-09, 1.60845e-05, 1, 1.32059e-06, -3.2818e-09, -1.32059e-06, 1, -2.50026e-07, 3.6012, -7.75122e-07)
bones/48/enabled = true
bones/48/position = Vector3(-2.50026e-07, 3.6012, -7.75122e-07)
bones/48/rotation = Quaternion(0.836665, 8.70473e-07, 0.068157, 0.543457)
bones/48/rotation = Quaternion(0.836665, 8.70474e-07, 0.068157, 0.543457)
bones/48/scale = Vector3(1, 1, 1)
bones/49/name = "mixamorig_RightHandRing3"
bones/49/parent = 48
@ -1301,14 +1362,14 @@ bones/60/parent = 0
bones/60/rest = Transform3D(-0.999981, -0.00611455, -7.52684e-05, 0.00611501, -0.999901, -0.0126672, 2.1931e-06, -0.0126674, 0.99992, -9.12503, -6.6556, -0.0553527)
bones/60/enabled = true
bones/60/position = Vector3(-9.12503, -6.6556, -0.0553527)
bones/60/rotation = Quaternion(-0.0339456, 0.334676, 0.92684, -0.166754)
bones/60/rotation = Quaternion(-0.0339455, 0.334676, 0.92684, -0.166754)
bones/60/scale = Vector3(1, 1, 1)
bones/61/name = "mixamorig_RightLeg"
bones/61/parent = 60
bones/61/rest = Transform3D(0.99993, -0.0118315, -0.000580536, 0.0118448, 0.999271, 0.0362854, 0.000150802, -0.0362897, 0.999341, 3.28565e-07, 40.5995, 1.49012e-08)
bones/61/enabled = true
bones/61/position = Vector3(3.28565e-07, 40.5995, 1.49012e-08)
bones/61/rotation = Quaternion(-0.581827, -0.0846291, -0.0166473, 0.808727)
bones/61/rotation = Quaternion(-0.581827, -0.0846291, -0.0166473, 0.808726)
bones/61/scale = Vector3(1, 1, 1)
bones/62/name = "mixamorig_RightFoot"
bones/62/parent = 61
@ -1344,7 +1405,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_j3emx")
[node name="HitCollisions" type="Node3D" parent="Body/Armature/Skeleton3D"]
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Body/Armature/Skeleton3D"]
transform = Transform3D(0.978017, -0.176546, -0.110972, 0.15839, 0.282801, 0.94601, -0.135631, -0.942791, 0.304547, -11.8203, 17.7472, -135.936)
transform = Transform3D(0.978017, -0.176546, -0.110973, 0.15839, 0.282801, 0.946011, -0.135631, -0.942791, 0.304547, -11.8203, 17.7472, -135.936)
bone_name = "mixamorig_Head"
bone_idx = 5
@ -1352,10 +1413,265 @@ bone_idx = 5
transform = Transform3D(9.90229, 1.3945, -6.09554e-08, 0, -4.37114e-07, -10, -1.3945, 9.90229, -4.32843e-07, 0.58762, 7.43451, 1.4646)
script = ExtResource("1_lianf")
[node name="Collision" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D/HeadCollision"]
shape = SubResource("CapsuleShape3D_k5bjr")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D/HeadCollision"]
shape = SubResource("SphereShape3D_axep3")
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D"]
[node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="Body/Armature/Skeleton3D"]
[node name="Physical Bone mixamorig_Hips" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(82.5044, -54.0559, -16.4615, 55.0482, 83.4649, 1.8195, 12.756, -10.5629, 98.619, 1.31498, 0.290623, -87.4646)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.50607e-08, -5.58794e-09, 0.0499956)
body_offset = Transform3D(100, -0.0695305, -0.00860631, -1.00136e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.000436783, 4.96175, -0.613665)
mass = 20.0
bone_name = "mixamorig_Hips"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Hips"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0.0161502, -2.32831e-11, 1.01774e-18)
shape = SubResource("CapsuleShape3D_0ptuo")
[node name="Physical Bone mixamorig_Spine" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(80.9412, -58.5461, -4.56913, 57.6046, 80.6695, -13.1964, 11.4119, 8.0493, 99.0201, 2.40599, 0.973749, -98.2036)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.06134e-09, 2.2377e-09, 0.05866)
body_offset = Transform3D(100, 1.52588e-05, 7.62939e-06, 4.76837e-06, -9.53674e-07, -100, -1.52588e-05, 100, -3.8147e-06, -9.53674e-07, 5.866, 0)
mass = 20.0
bone_name = "mixamorig_Spine"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Spine"]
transform = Transform3D(0.0318071, 3.86358e-14, 4.9738e-14, -2.13163e-14, -1.62981e-09, 0.0318071, -4.26326e-14, -0.0318071, -1.62981e-09, -0.00245133, -5.91656e-09, -0.223859)
shape = SubResource("CapsuleShape3D_126jt")
[node name="Physical Bone mixamorig_Head" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-97.8019, 4.47329, 20.366, -15.8369, -79.4709, -58.5966, 13.5638, -60.5339, 78.4325, -13.8193, 23.4986, -143.635)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.83517e-10, -1.39698e-07, 0.0981531)
body_offset = Transform3D(-100, -0.00220108, -0.000778198, -5.24521e-06, 33.8066, -94.1122, 0.00232792, -94.1122, -33.8066, 7.62939e-05, 9.23741, 3.31821)
mass = 7.0
bone_name = "mixamorig_Head"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Head"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_1gw5y")
[node name="Physical Bone mixamorig_LeftArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787, 22.6659, 75.4396, 61.6046, 16.1942, 31.0309, -132.592)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.70432e-08, 8.67479e-08, 0.137023)
body_offset = Transform3D(100, -3.05176e-05, -3.43323e-05, 1.71661e-05, 100, -7.62939e-06, 1.52588e-05, -3.8147e-06, 100, 0, -7.62939e-06, -13.7023)
mass = 3.0
bone_name = "mixamorig_LeftArm"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftArm"]
transform = Transform3D(0.01, 0, 0, 0, 0.00997432, -0.000716193, 0, 0.000716193, 0.00997432, 4.61853e-15, 0.165399, 0.142978)
shape = SubResource("CapsuleShape3D_krlof")
[node name="Physical Bone mixamorig_LeftForeArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-48.2566, -12.058, 86.752, -78.7312, -37.4258, -48.997, 38.3757, -91.9452, 8.56699, 1.36485, 46.9033, -104.66)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.52506e-07, 1.36787e-07, 0.138072)
body_offset = Transform3D(100, 2.86102e-05, -3.8147e-05, -3.8147e-05, -1.90735e-06, -100, -3.8147e-06, 100, 1.14441e-05, 3.05176e-05, 13.8072, -1.52588e-05)
mass = 3.0
bone_name = "mixamorig_LeftForeArm"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftForeArm"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_2k34c")
[node name="Physical Bone mixamorig_LeftHand" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(9.11563, -98.6768, 13.4089, 23.9481, -10.8976, -96.4766, 96.6612, 12.0056, 22.6379, -10.9685, 56.2242, -106.442)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.24797e-07, -1.22003e-07, 0.0264902)
body_offset = Transform3D(-58.5197, 57.9894, 56.6805, 1.62125e-05, 69.899, -71.5132, -81.0891, -41.8493, -40.9047, -1.50148, 1.89441, 1.08356)
bone_name = "mixamorig_LeftHand"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftHand"]
transform = Transform3D(0.01, 0, 0, 0, 0.00697578, 0.00716509, 0, -0.00716509, 0.00697578, 9.31323e-12, 0.0631712, -0.0648856)
shape = SubResource("CapsuleShape3D_5fgdh")
[node name="Physical Bone mixamorig_RightArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(30.7246, 72.8896, 61.1809, 93.7855, -34.092, -6.48192, 16.1331, 59.3704, -78.8345, -27.5296, -1.29566, -110.13)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.50277e-08, 1.15999e-07, 0.137023)
body_offset = Transform3D(100, -5.72205e-06, 1.09673e-05, 6.67572e-06, 1.07288e-05, -100, -1.90735e-06, 100, 2.67029e-05, 0, 13.7023, -1.52588e-05)
mass = 3.0
bone_name = "mixamorig_RightArm"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightArm"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_8vkyv")
[node name="Physical Bone mixamorig_RightForeArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(24.3552, 37.4063, 89.4852, -25.0101, 91.5653, -31.4688, -93.7087, -14.716, 31.6563, -48.2682, 3.93749, -103.698)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.38762e-07, -5.86307e-09, 0.138072)
body_offset = Transform3D(100, -9.53674e-06, 1.00136e-05, -3.8147e-06, 100, 3.8147e-06, 5.72205e-06, -5.72205e-06, 100, -1.52588e-05, 5.96046e-08, -13.8072)
mass = 3.0
bone_name = "mixamorig_RightForeArm"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightForeArm"]
transform = Transform3D(0.01, 0, 0, 0, 0.00999714, -0.000239087, 0, 0.000239087, 0.00999714, 2.23821e-15, 0.145694, 0.138911)
shape = SubResource("CapsuleShape3D_fh1k4")
[node name="Physical Bone mixamorig_RightHand" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(89.0767, -24.8074, -38.0781, 5.05123, 88.6726, -45.9527, 45.1645, 39.0097, 80.2397, -24.5746, 26.0951, -105.517)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.86265e-08, 2.31434e-07, 0.0264903)
body_offset = Transform3D(-58.5197, -57.9893, -56.6805, -1.04904e-05, 69.8991, -71.5131, 81.0891, -41.8492, -40.9048, 1.5015, 1.89439, 1.08359)
bone_name = "mixamorig_RightHand"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightHand"]
transform = Transform3D(0.01, 0, 0, 0, 0.00693402, 0.00720551, 0, -0.00720551, 0.00693402, -3.72529e-11, 0.0680192, -0.0706824)
shape = SubResource("CapsuleShape3D_1m8r5")
[node name="Physical Bone mixamorig_LeftUpLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-96.1774, -26.2684, 7.73901, -23.4203, 64.2554, -72.957, 14.1919, -71.9807, -67.9513, 5.83707, 19.601, -60.9754)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.78612e-08, -7.74374e-09, 0.202997)
body_offset = Transform3D(100, -2.67029e-05, 9.53674e-06, 5.72205e-06, 7.62939e-06, -100, 3.33786e-05, 100, 3.8147e-06, -5.72205e-06, 20.2997, 0)
mass = 5.0
bone_name = "mixamorig_LeftUpLeg"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftUpLeg"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_3cygo")
[node name="Physical Bone mixamorig_LeftLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-97.5216, -11.6193, -18.8291, -22.0483, 58.1427, 78.3154, 1.84805, 80.5259, -59.2635, 8.22949, 17.9261, -34.7068)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.01576e-09, -2.10753e-08, 0.210495)
body_offset = Transform3D(100, 4.76837e-06, 1.14441e-05, 5.72205e-06, 0, -100, -9.53674e-07, 100, 1.90735e-05, -1.90735e-06, 21.0495, -1.90735e-06)
mass = 5.0
bone_name = "mixamorig_LeftLeg"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftLeg"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_vwdij")
[node name="Physical Bone mixamorig_LeftFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-93.6712, -34.5296, 5.78095, -34.9451, 91.207, -21.4506, 2.13418, -22.1132, -97.501, 11.7385, 3.12728, -14.5678)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.53808e-09, 5.17146e-08, 0.078608)
body_offset = Transform3D(100, 5.72205e-06, -3.8147e-06, -3.8147e-06, -1.52588e-05, -100, -5.72205e-06, 100, -3.24249e-05, 9.53674e-07, 7.8608, -2.6226e-06)
bone_name = "mixamorig_LeftFoot"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftFoot"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_qyg6j")
[node name="Physical Bone mixamorig_RightUpLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-83.6898, -51.5224, 18.4786, -50.5592, 59.8312, -62.161, 20.9708, -61.3651, -76.122, -11.4062, 7.37456, -61.646)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08665e-08, 7.74372e-09, 0.202997)
body_offset = Transform3D(100, -1.52588e-05, 3.8147e-06, 5.72205e-06, -3.8147e-06, -100, 1.14441e-05, 100, -3.8147e-06, -2.86102e-06, 20.2997, 0)
mass = 5.0
bone_name = "mixamorig_RightUpLeg"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightUpLeg"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CapsuleShape3D_a81km")
[node name="Physical Bone mixamorig_RightLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-91.8175, -23.5086, -31.8888, -36.0103, 83.0805, 42.437, 16.517, 50.4478, -84.7479, -8.44487, 11.0604, -28.3544)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.06137e-10, -2.07784e-07, 0.210495)
body_offset = Transform3D(100, -1.52588e-05, 1.33514e-05, -9.53674e-07, 3.8147e-05, -100, 1.90735e-05, 100, 5.34058e-05, -2.86102e-06, 21.0495, 9.53674e-06)
mass = 5.0
bone_name = "mixamorig_RightLeg"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightLeg"]
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
shape = SubResource("CylinderShape3D_2binp")
[node name="Physical Bone mixamorig_RightFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(-88.192, -17.3351, 43.8367, -46.8549, 42.4444, -77.4796, -5.17505, -88.8705, -45.5549, -5.17837, 8.21811, -6.93437)
collision_layer = 4
collision_mask = 4
joint_type = 1
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.24153e-08, -2.70381e-09, 0.078608)
body_offset = Transform3D(100, 1.14441e-05, -7.62939e-06, -7.62939e-06, -1.90735e-05, -100, 0, 100, -5.72205e-05, 5.84126e-06, 7.8608, 4.76837e-06)
bone_name = "mixamorig_RightFoot"
joint_constraints/bias = 0.3
joint_constraints/damping = 1.0
joint_constraints/impulse_clamp = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightFoot"]
transform = Transform3D(0.01, 1.50737e-10, 9.12129e-10, 0, 0.00258819, 0.00965926, -4.42378e-09, -0.00965926, 0.00258819, 6.02947e-10, 0.0103528, -0.038637)
shape = SubResource("CylinderShape3D_l2il6")
[node name="Collision" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(9.83936, 0.264962, 1.76546, 0.249217, 9.58855, -2.82801, -1.76775, 2.82658, 9.42791, -12.7207, 21.3283, -142.579)
shape = SubResource("SphereShape3D_wnhib")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Body"]
libraries = {

View File

@ -1,13 +1,13 @@
extends Area3D
@export var damage: int = 100
@export var damage: int = 20
signal body_part_hit(dam)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://b10lpwfjgxds4"]
[gd_scene load_steps=11 format=3 uid="uid://b10lpwfjgxds4"]
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
@ -14,6 +14,9 @@ properties/0/replication_mode = 1
properties/1/path = NodePath(".:rotation")
properties/1/spawn = true
properties/1/replication_mode = 1
properties/2/path = NodePath(".:health")
properties/2/spawn = true
properties/2/replication_mode = 2
[sub_resource type="Animation" id="Animation_falg4"]
length = 0.001
@ -72,6 +75,13 @@ _data = {
"shooting": SubResource("Animation_ah507")
}
[sub_resource type="LabelSettings" id="LabelSettings_toaij"]
font_size = 70
[sub_resource type="LabelSettings" id="LabelSettings_1j1uq"]
font_size = 100
font_color = Color(0.756874, 0, 0.223924, 1)
[node name="CharacterPlaceholder" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.799455, 0)
collision_layer = 9
@ -85,7 +95,7 @@ shape = SubResource("CapsuleShape3D_jc50w")
replication_config = SubResource("SceneReplicationConfig_tl74a")
[node name="FirstPersonCameraMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.609154, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.609154, -0.209324)
[node name="Camera" type="Camera3D" parent="FirstPersonCameraMount"]
fov = 40.0
@ -96,6 +106,7 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0,
[node name="AimRay" type="RayCast3D" parent="FirstPersonCameraMount/BulletStartingPoint"]
target_position = Vector3(0, 0, 1000)
hit_from_inside = true
collide_with_areas = true
[node name="GunMount" type="Node3D" parent="FirstPersonCameraMount"]
@ -130,5 +141,23 @@ grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_lsd7c")
[node name="HealthIndicator" type="Label" parent="FirstPersonCameraMount/HUD"]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -23.0
offset_right = 40.0
grow_vertical = 0
text = "100"
label_settings = SubResource("LabelSettings_toaij")
[node name="FPS" type="Label" parent="FirstPersonCameraMount/HUD" groups=["player_placeholder"]]
layout_mode = 1
offset_right = 40.0
offset_bottom = 23.0
text = "0"
label_settings = SubResource("LabelSettings_1j1uq")
[node name="ModelMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,15 @@ extends CSGBox3D
var health = 5
@export var color: Color = Color(0, 0, 0)
var colors = [Color(1.0, 0.0, 0.0, 1.0),
Color(0.0, 1.0, 0.0, 1.0),
Color(0.0, 0.0, 1.0, 0.0)]
func take_damage():
health -= 1
color = Color(randf(), randf(), randf())
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@ -11,5 +18,6 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
material_override.albedo_color = color
if health < 1:
queue_free()

View File

@ -16,7 +16,7 @@ func _ready() -> void:
if multiplayer.is_server():
for i in GameServerManager.players:
char = ResourceLoader.load("res://scenes/characters/placeholder.tscn").instantiate()
char.name = str(GameServerManager.players[i].name)
char.name = "PlayerPlaceholder_" + str(GameServerManager.players[i].name)
char.global_position = position
var my_random_number = RandomNumberGenerator.new().randf_range(0.0, 5.0)
char.global_position = position
@ -26,7 +26,15 @@ func _ready() -> void:
$MultiplayerSpawner.spawn(char)
players.add_child(char)
var bullet_amount: int = 0
func spawn_bullet(position):
var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
node.position = position.global_position
node.transform.basis = position.global_transform.basis
node.name = str(bullet_amount)
bullet_amount += 1
#$BulletSpawner.spawn(node)
$Bullets.add_child(node)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
extends CSGBox3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

17
scenes/maps/hud.gd Normal file
View File

@ -0,0 +1,17 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@onready var health_indicator: Label = $HealthIndicator
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var root := get_tree().get_root()
var id := multiplayer.get_unique_id()
var player_data = GameServerManager.get_player_health.rpc_id(1, id)
health_indicator.text = str(player_data["health"])
pass

View File

@ -13,7 +13,6 @@ func _ready() -> void:
func _process(delta: float) -> void:
var blue := $ChooseTeam/Blue
var red := $ChooseTeam/Read
if
if raycast.is_colliding():
var collider = raycast.get_collider()
if collider and collider.name == target_node_name:

View File

@ -35,6 +35,14 @@ offset_right = 224.0
offset_bottom = 220.0
text = "Join"
[node name="TextEdit" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 238.0
offset_top = 151.0
offset_right = 497.0
offset_bottom = 220.0
text = "192.168.0.28"
[connection signal="player_connected" from="." to="." method="_on_player_connected"]
[connection signal="player_disconnected" from="." to="." method="_on_player_disconnected"]
[connection signal="server_disconnected" from="." to="." method="_on_server_disconnected"]

View File

@ -0,0 +1,11 @@
extends Control
@onready =
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -0,0 +1,55 @@
[gd_scene load_steps=5 format=3 uid="uid://c137wl6ls3knx"]
[ext_resource type="Script" path="res://scenes/utils/in_game_hud.gd" id="1_sttf0"]
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_fjr6q"]
[sub_resource type="LabelSettings" id="LabelSettings_ds4qb"]
font_size = 70
[sub_resource type="LabelSettings" id="LabelSettings_vhjwu"]
font_size = 100
font_color = Color(0.756874, 0, 0.223924, 1)
[node name="InGameHud" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_sttf0")
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -28.0
offset_top = -36.0
offset_right = 44.0
offset_bottom = 36.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_fjr6q")
[node name="HealthIndicator" type="Label" parent="."]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 8.0
offset_top = -96.0
offset_right = 128.0
grow_vertical = 0
text = "100"
label_settings = SubResource("LabelSettings_ds4qb")
[node name="FPS" type="Label" parent="." groups=["player_placeholder"]]
layout_mode = 1
offset_left = 8.0
offset_right = 65.0
offset_bottom = 137.0
text = "0"
label_settings = SubResource("LabelSettings_vhjwu")

View File

@ -10,7 +10,7 @@ signal server_disconnected
const PORT = 7000
const DEFAULT_SERVER_IP = "127.0.0.1" # IPv4 localhost
const MAX_CONNECTIONS = 20
@onready var address_input: TextEdit = $TextEdit
var players = {}
var my_random_number = RandomNumberGenerator.new().randf_range(-2.0, 2.0)
var player_info = {"name": str(my_random_number)}
@ -25,8 +25,7 @@ func _ready() -> void:
multiplayer.server_disconnected.connect(_on_server_disconnected)
func join_game(address = ""):
if address.is_empty():
address = DEFAULT_SERVER_IP
address = address_input.text
var peer = ENetMultiplayerPeer.new()
var error = peer.create_client(address, PORT)
if error:
@ -66,7 +65,7 @@ func player_loaded():
# When a peer connects, send them my player info.
# This allows transfer of all desired data for each player, not only the unique ID.
func _on_player_connected(id):
player_info = {"name": multiplayer.get_unique_id()}
player_info = {"name": multiplayer.get_unique_id(), "health": 100}
_register_player.rpc_id(1, multiplayer.get_unique_id(), player_info)
@rpc("any_peer", "reliable")
@ -104,7 +103,7 @@ func _on_server_disconnected():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _on_host_pressed() -> void:
player_info = {"name": str(1)}
player_info = {"name": str(1), "health": 100}
_register_player(1, player_info)
create_game()

View File

@ -1,6 +1,6 @@
extends Node3D
const SPEED = 715
const SPEED = 200 # 200
@onready var mesh = $RigidBody3D/MeshInstance3D
@onready var rigid_body_3d: RigidBody3D = $RigidBody3D
@ -14,12 +14,19 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var time_per_frame: float = 1 / Engine.get_frames_per_second()
var distance: float = time_per_frame * SPEED * 1.5
ray.target_position.z = distance
position += transform.basis * Vector3(0, 0, SPEED) * delta
rigid_body_3d.set_use_continuous_collision_detection(true)
#ray.collision_mask = 1
#ray.enabled = 1
ray.target_position.z = SPEED / Engine.get_frames_per_second()
if ray.is_colliding():
var collider = ray.get_collider()
if collider != null and collider.is_in_group("target"):
ray.get_collider().take_damage()
if collider != null and collider.is_in_group("body"):
ray.get_collider().hit()
rigid_body_3d.visible = false
particles.emitting = true
#if ray.get_collider().is_in_group("body"):

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://b0agqeg53tey5"]
[gd_scene load_steps=9 format=3 uid="uid://b0agqeg53tey5"]
[ext_resource type="Script" path="res://scenes/weapon/bullet.gd" id="1_th28m"]
@ -30,7 +30,16 @@ linear_accel_max = 6.67
[sub_resource type="BoxMesh" id="BoxMesh_mfkmi"]
size = Vector3(0.05, 0.05, 0.05)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_b8q4c"]
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 0
properties/1/path = NodePath(".:rotation")
properties/1/spawn = true
properties/1/replication_mode = 0
[node name="Bullet" type="Node3D"]
transform = Transform3D(20, 0, 0, 0, 20, 0, 0, 0, 20, 0, 0, 0)
script = ExtResource("1_th28m")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
@ -62,11 +71,14 @@ shape = SubResource("CylinderShape3D_l3sdq")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.18476)
material_override = SubResource("StandardMaterial3D_ynv38")
emitting = false
amount = 10
amount = 100
lifetime = 6.29
one_shot = true
explosiveness = 1.0
process_material = SubResource("ParticleProcessMaterial_58cgi")
draw_pass_1 = SubResource("BoxMesh_mfkmi")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_b8q4c")
[connection signal="timeout" from="RigidBody3D/Timer" to="." method="_on_timer_timeout"]

View File

@ -1,6 +1,6 @@
extends Node3D
const SPEED = 715
const SPEED = 10
@onready var mesh = $Object_10

View File

@ -19,9 +19,9 @@ func shoot() -> Error:
return ERR_CANT_OPEN
var node: MeshInstance3D = scene.instantiate()
node.init(bullet_start_node.global_position, bullet_end_node.global_position)
var root := get_tree().get_root()
root.add_child(node)
node.init(bullet_start_node.position, bullet_end_node.position)
#var root := get_tree().get_root()
bullet_start_node.add_child(node)
return OK
else:
push_warning("Couldn't generate a bullet trace, no distance node found")

View File

@ -1,5 +1,6 @@
extends MeshInstance3D
var alpha = 1.0
func init(pos1, pos2):
var draw_mesh := ImmediateMesh.new()
mesh = draw_mesh
@ -10,12 +11,15 @@ func init(pos1, pos2):
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var dup_material = material_override.duplicate()
material_override = dup_material
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
alpha -= delta * 3.5
material_override.albedo_color.a = alpha
func _on_timer_timeout() -> void:

View File

@ -3,9 +3,12 @@
[ext_resource type="Script" path="res://scenes/weapon/misc/bullet_trail_generic.gd" id="1_k8eg1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ybqvs"]
albedo_color = Color(0.934388, 0.967243, 0.955863, 1)
emission = Color(1, 1, 1, 1)
emission_energy_multiplier = 2.7
transparency = 1
albedo_color = Color(0.300204, 0.908317, 1.54018e-06, 0.458824)
emission_enabled = true
emission = Color(0.454139, 0.861507, 0, 1)
emission_energy_multiplier = 16.0
distance_fade_min_distance = 2.0
[node name="BulletTrailGeneric" type="MeshInstance3D"]
material_override = SubResource("StandardMaterial3D_ybqvs")

View File

@ -1,11 +1,15 @@
extends Node
var players = {}
var local_player_health = 0
# Called when the node enters the scene tree for the first time.
@rpc("reliable", "call_local")
func get_player_health(id: int) -> int:
return players.get(id)["health"]
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -3,7 +3,8 @@
# ---------------------------------------------------------------------
class_name PlayerInput extends CharacterBody3D
var health: int = 100
@export var health: int = 100
@export_category("PlayerInput")
@ -16,6 +17,7 @@ var mouse_captured: bool = false
@onready var first_view_camera_mount: Node3D = $FirstPersonCameraMount
@onready var first_view_camera: Camera3D = $FirstPersonCameraMount/Camera
@onready var model_mount: Node3D = $ModelMount
var model: Node3D = null
# -- This node is supposed to be spawned per player, and since each
# -- player has an id, it is used for giving a node a name. So we can
@ -38,32 +40,59 @@ func _ready() -> void:
var err := _add_first_view_model()
if err != OK:
print("Error occured: " + str(err))
_enable_camera()
else:
var err := _add_world_model()
err = _add_legs_to_first_view()
if err != OK:
print("Error occured: " + str(err))
var world_model := _add_world_model()
if world_model == null:
print("Error occured: " + "couldn't load the world model")
_enable_camera()
else:
var world_model := _add_world_model()
if world_model == null:
print("Error occured: " + "couldn't load the world model")
_hide_camera_mount()
_capture_mouse()
# -- Add a world model to the player, that should be seen by other players
# -- on the server
func _add_world_model() -> Error :
func _add_world_model() -> Node3D :
# -- TODO: It should not be hardcoded
var path := "res://scenes/characters/blue/dummy.tscn"
if not ResourceLoader.exists(path):
return ERR_DOES_NOT_EXIST
push_error(ERR_DOES_NOT_EXIST)
return null
var scene: PackedScene = ResourceLoader.load(path)
if not scene.can_instantiate():
return ERR_CANT_OPEN
push_error(ERR_CANT_OPEN)
return null
var node: Node3D = scene.instantiate()
model = node
model_mount.add_child(node)
return OK
if _is_current_player():
node.make_invisible()
first_view_camera.cull_mask &= ~(1 << 1)
return node
func _hide_camera_mount():
first_view_camera_mount.visible = 0
hud.visible = 0
func make_node_invisible_for_camera(node: Node3D, camera: Camera3D):
if node and camera:
# Set the node to Layer 2 (or any other layer you want)
node.visibility_layer = 1 << 1 # Assign the node to Layer 2
# Disable Layer 2 on the camera's culling mask (this makes it invisible to this camera)
camera.cull_mask &= ~(1 << 1) # Disable Layer 2 on this camera
var current_gun: String = "ak"
@onready var gun_mount: Node3D = $FirstPersonCameraMount/GunMount
@onready var gun_mount_anim: AnimationPlayer = $FirstPersonCameraMount/GunMount/AnimationPlayer
var gun_with_hands: Node3D = null
# -- Add the first person view to pthe player
func _add_first_view_model() -> Error :
# -- TODO: It should not be hardcoded
@ -81,6 +110,30 @@ func _add_first_view_model() -> Error :
gun_with_hands = node
gun_mount.add_child(node)
return OK
var first_view_legs_anim: AnimationPlayer = null
# -- Add a world model to the player, that should be seen by other players
# -- on the server
func _add_legs_to_first_view() -> Error :
# -- TODO: It should not be hardcoded
var path := "res://scenes/characters/blue/dummy.tscn"
if not ResourceLoader.exists(path):
return ERR_DOES_NOT_EXIST
var scene: PackedScene = ResourceLoader.load(path)
if not scene.can_instantiate():
return ERR_CANT_OPEN
var node: Node3D = scene.instantiate()
var skeleton: Skeleton3D = node.find_child("Skeleton3D")
var bone := skeleton.find_bone("mixamorig_Spine")
if bone != -1:
skeleton.set_bone_pose_scale(bone, Vector3(0, 0, 0))
model_mount.add_child(node)
var animation_node: AnimationPlayer = node.find_child("AnimationPlayer")
if animation_node != null:
first_view_legs_anim = animation_node
return OK
func _enable_camera():
first_view_camera.make_current()
@ -130,6 +183,23 @@ func _rotate_camera(sens_mod: float = 1.0) -> void:
rotation.y -= look_dir.x * camera_sens * sens_mod
first_view_camera_mount.rotation.x = clamp(first_view_camera_mount.rotation.x - look_dir.y * camera_sens * sens_mod, -1.5, 1.5)
@onready var hud = $FirstPersonCameraMount/HUD
@onready var health_indicator = $FirstPersonCameraMount/HUD/HealthIndicator
@onready var fps_indicator = $FirstPersonCameraMount/HUD/FPS
func _process(delta: float) -> void:
health_indicator.text = str(health)
fps_indicator.text = str(Engine.get_frames_per_second())
if health == 0:
alive = false
var world: Node3D = find_parent("ElTest")
var spawner: MultiplayerSpawner = world.find_child("ObjectsSpawner")
var objects_root: Node3D = world.find_child("Objects")
spawner.spawn(model)
model.reparent(get_tree().get_root())
model.die()
queue_free()
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
@ -148,15 +218,19 @@ func _physics_process(delta: float) -> void:
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
gun_mount_anim.play("move")
if first_view_legs_anim != null:
first_view_legs_anim.play("Run Forward")
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
if gun_mount_anim.is_playing():
gun_mount_anim.stop()
if first_view_legs_anim != null and first_view_legs_anim.is_playing():
first_view_legs_anim.stop()
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()
if alive:
move_and_slide()
# -- TODO: It shouldn't be hardcoded
var bullet = load("res://scenes/weapon/bullet.tscn")
@ -164,14 +238,28 @@ var bullet = load("res://scenes/weapon/bullet.tscn")
@onready var bullet_starting_point: Node3D = $FirstPersonCameraMount/BulletStartingPoint
@onready var aim_ray: RayCast3D = $FirstPersonCameraMount/BulletStartingPoint/AimRay
# --find the gun node and exec shoot
var cant_shoot: bool = false
func _shoot():
if aim_ray.is_colliding():
var collider := aim_ray.get_collider()
if collider != null and collider.is_in_group("target"):
aim_ray.get_collider().take_damage()
var root := get_tree().get_root()
gun_with_hands.shoot()
if not cant_shoot:
_send_shot_to_server.rpc_id(1, aim_ray.global_position)
if aim_ray.is_colliding():
var collider := aim_ray.get_collider()
if collider != null and collider.is_in_group("target"):
aim_ray.get_collider().take_damage()
if collider != null and collider.is_in_group("body"):
collider.hit()
var root := get_tree().get_root()
gun_with_hands.shoot()
cant_shoot = true
await get_tree().create_timer(0.2).timeout
cant_shoot = false
@rpc("any_peer", "call_local", "unreliable_ordered")
func _send_shot_to_server(start_position):
# -- TODO: Should not be hardcoded
var world: Node3D = find_parent("ElTest")
world.spawn_bullet(bullet_starting_point)
func _get_camera_collision():
var viewport = get_viewport().size
var ray_origin = first_view_camera.project_ray_origin(viewport / 2)
@ -198,3 +286,13 @@ func _hit_scan_collision(collision_point):
func _hit_scan_damage(Collider):
#if Collider.is_in_group("target") and Collider.has_method("take_damage"):
print("damaged")
func take_damage(dam: int):
var new_health = health - dam
set_health(new_health)
if multiplayer.is_server():
set_health.rpc(new_health)
@rpc("call_local", "reliable")
func set_health(val: int):
health = val