Add a 3D ragdoll physics demo (#1234)

This commit is contained in:
Hugo Locurcio
2025-09-30 22:05:04 +02:00
committed by GitHub
parent 0540894062
commit efb56dcee4
28 changed files with 1168 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# Ragdoll Physics
This demo includes an example of ragdoll simulation for characters.
The ragdoll setup in this demo was performed by following the [Ragdoll system](https://docs.godotengine.org/en/stable/tutorials/physics/ragdoll_system.html)
tutorial. The character script also has an `initial_velocity` variable implemented,
which will give an impulse to all bones part of the ragdoll system.
This initial impulse is typically used in games to make ragdoll effects more impactful,
e.g. giving additional recoil after taking a punch.
Impact sounds are played according to the impact speed, and are played with
reduced pitch when slow motion mode is engaged. This uses
`AudioServer.playback_speed_scale` which affects all audio,
so in a more complex project, you would want to use
[audio buses](https://docs.godotengine.org/en/stable/tutorials/audio/audio_buses.html)
which can make the effect only apply to certain sounds. This can be used to keep
music unaffected by the pitch shifting effect.
Character models use outlines provided by the BaseMaterial3D **Stencil > Mode**
property. The scene's static geometry is designed using CSG nodes and is baked to a
static mesh and collision to improve load times and allow for global illumination
with LightmapGI.
Controls:
- <kbd>Space</kbd>: Add a ragdoll at the mouse cursor position
- <kbd>Shift</kbd> (hold): Enable slow motion mode (1/4 speed)
- <kbd>R</kbd>: Reset ragdoll simulation and remove user-placed ragdolls
- <kbd>Right Mouse Button</kbd>: Orbit camera
- <kbd>Mouse Wheel</kbd>: Zoom
Language: GDScript
Renderer: Forward+
## Screenshots
![Screenshot](screenshots/ragdoll_physics.webp)

View File

@@ -0,0 +1,7 @@
# License for `mannequiny.glb`
Copyright (c) 2020 GDQuest and contributors (https://www.gdquest.com/)
Licensed under CC BY 4.0 International
Downloaded from <https://github.com/gdquest-demos/godot-3d-mannequin/issues/19#issuecomment-582235299>.

Binary file not shown.

View File

@@ -0,0 +1,60 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://s42h0rnuf2hf"
path="res://.godot/imported/mannequiny.glb-c63c284f6fd6b41bb34b1c5bea848ecd.scn"
[deps]
source_file="res://characters/mannequiny.glb"
dest_files=["res://.godot/imported/mannequiny.glb-c63c284f6fd6b41bb34b1c5bea848ecd.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=3
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Azul_COLOR_0": {
"use_external/enabled": true,
"use_external/fallback_path": "res://materials/blue.tres",
"use_external/path": "uid://ch6ctajgm6nyy"
},
"Blanco_COLOR_0": {
"use_external/enabled": true,
"use_external/fallback_path": "res://materials/white.tres",
"use_external/path": "uid://dyij7l6ir0ixa"
},
"Negro_COLOR_0": {
"use_external/enabled": true,
"use_external/fallback_path": "res://materials/black.tres",
"use_external/path": "uid://brpxmsr7g2gh6"
}
}
}
gltf/naming_version=2
gltf/embedded_image_handling=1

View File

@@ -0,0 +1,36 @@
extends Node3D
const IMPACT_SOUND_SPEED_SMALL = 0.3
const IMPACT_SOUND_SPEED_BIG = 1.0
## The velocity to apply on the first physics frame.
@export var initial_velocity: Vector3
var has_applied_initial_velocity: bool = false
# Used to play an impact sound on sudden velocity changes.
# We use the pelvis bone as it's close to the center of mass of the character model.
# For more detailed impact sounds, you could place multiple AudioStreamPlayer nodes as a child
# of each limb.
var previous_pelvis_speed: float = 0.0
@onready var pelvis: PhysicalBone3D = $"root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone pelvis"
func _ready() -> void:
$root/root_001/Skeleton3D/PhysicalBoneSimulator3D.physical_bones_start_simulation()
if not initial_velocity.is_zero_approx():
for physical_bone in $root/root_001/Skeleton3D/PhysicalBoneSimulator3D.get_children():
# Give the ragdoll an initial motion by applying velocity on all its bones upon being spawned.
physical_bone.apply_central_impulse(initial_velocity)
func _physics_process(_delta: float) -> void:
var pelvis_speed: float = pelvis.linear_velocity.length()
# Ensure the speed used to determine the threshold doesn't change with time scale.
var impact_speed := (previous_pelvis_speed - pelvis_speed) / Engine.time_scale
if impact_speed > IMPACT_SOUND_SPEED_BIG:
$ImpactSoundBig.play()
elif impact_speed > IMPACT_SOUND_SPEED_SMALL:
$ImpactSoundSmall.play()
previous_pelvis_speed = pelvis_speed

View File

@@ -0,0 +1 @@
uid://bvbikscp01gbc

View File

@@ -0,0 +1,529 @@
[gd_scene load_steps=25 format=3 uid="uid://b3ro5p8ydfhgh"]
[ext_resource type="PackedScene" uid="uid://s42h0rnuf2hf" path="res://characters/mannequiny.glb" id="1_k1ufn"]
[ext_resource type="Script" uid="uid://bvbikscp01gbc" path="res://characters/mannequiny_ragdoll.gd" id="2_swgnv"]
[ext_resource type="AudioStream" uid="uid://drrptt1g0n2vh" path="res://sounds/impact_small.wav" id="3_rx62r"]
[ext_resource type="AudioStream" uid="uid://urcgf5c0ln36" path="res://sounds/impact_big.wav" id="4_63wjt"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_swgnv"]
radius = 0.07
height = 0.3
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_pxhot"]
radius = 0.06
height = 0.4
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rx62r"]
radius = 0.05
height = 0.42794177
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_63wjt"]
radius = 0.04
height = 0.2
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lgsap"]
radius = 0.119
height = 0.26
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_b8qrq"]
radius = 0.15
height = 0.32
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ro32m"]
radius = 0.04
height = 0.1
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_76ik7"]
radius = 0.05
height = 0.15
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_hp5ob"]
radius = 0.05
height = 0.2619829
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_k82ed"]
radius = 0.04
height = 0.20732063
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_81x62"]
radius = 0.04
height = 0.2
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_c87p0"]
radius = 0.05
height = 0.15
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_wodjd"]
radius = 0.05
height = 0.26198295
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_osl3f"]
radius = 0.04
height = 0.2073207
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_tohjf"]
radius = 0.04
height = 0.2
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2jrde"]
radius = 0.038935494
height = 0.38935494
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_hpv8y"]
radius = 0.05
height = 0.428
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ifqtp"]
radius = 0.04
height = 0.2
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_lgsap"]
random_pitch = 1.05
random_volume_offset_db = 2.0
streams_count = 1
stream_0/stream = ExtResource("3_rx62r")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_pxhot"]
random_pitch = 1.05
random_volume_offset_db = 2.0
streams_count = 1
stream_0/stream = ExtResource("4_63wjt")
[node name="Mannequiny" instance=ExtResource("1_k1ufn")]
script = ExtResource("2_swgnv")
[node name="Skeleton3D" parent="root/root_001" index="0"]
bones/0/position = Vector3(-0.0073073814, 0.25549555, -0.9654906)
bones/0/rotation = Quaternion(-0.6010748, 0.09516296, -0.10946029, 0.7859209)
bones/1/position = Vector3(0.101934776, -0.026014993, 0.00481082)
bones/1/rotation = Quaternion(0.64258534, 0.10058304, 0.75958246, 0.0013437299)
bones/1/scale = Vector3(0.99999803, 1.0267714, 0.9999957)
bones/2/position = Vector3(9.745526e-07, 0.38935488, -1.1713537e-06)
bones/2/rotation = Quaternion(-4.4121425e-05, 4.4676483e-05, 0.0025771966, 0.9999967)
bones/2/scale = Vector3(0.9999994, 1.0000013, 1)
bones/3/rotation = Quaternion(0.32753584, 0.4100146, -0.26517764, 0.8088814)
bones/3/scale = Vector3(0.9992763, 0.9894031, 0.9860808)
bones/4/position = Vector3(0.0017231808, 0.12762056, -0.003080215)
bones/4/rotation = Quaternion(0.10457491, 0.9430038, 0.31486666, -0.02582683)
bones/4/scale = Vector3(1.0001645, 0.98759276, 1.0120888)
bones/5/rotation = Quaternion(-0.121235915, -0.14759062, 0.012175115, 0.98151445)
bones/6/rotation = Quaternion(-0.07025626, 0.0032932563, 0.00023194533, 0.99752355)
bones/7/rotation = Quaternion(0.3137003, 0.0063864617, 0.0021100962, 0.9494983)
bones/8/rotation = Quaternion(-0.16917156, -0.00666159, -0.0011357268, 0.98556346)
bones/9/rotation = Quaternion(0.46739042, 0.60986483, -0.507783, 0.3895737)
bones/10/rotation = Quaternion(-0.4275008, 0.5223583, 0.36764285, -0.6397059)
bones/11/rotation = Quaternion(0.31197274, -0.12640734, -0.23658149, 0.9114403)
bones/11/scale = Vector3(1, 0.99993074, 1.0000005)
bones/12/position = Vector3(-4.6001605e-07, 0.2073206, 9.5180917e-07)
bones/12/rotation = Quaternion(0.057765473, -0.28268203, 0.0073279897, 0.9574447)
bones/12/scale = Vector3(0.999999, 1.0000682, 1.0000001)
bones/13/position = Vector3(0.049143255, 0.050087444, -0.0046549165)
bones/13/rotation = Quaternion(0.04670327, 0.7870346, -0.3169294, 0.52721083)
bones/13/scale = Vector3(1.0000038, 0.99999505, 1.000001)
bones/14/rotation = Quaternion(-0.024159074, 0.306848, -0.06241794, 0.9494023)
bones/14/scale = Vector3(0.9999969, 0.9999976, 1.0000039)
bones/15/rotation = Quaternion(-0.009287203, -0.4385284, -0.008409321, 0.89863)
bones/15/scale = Vector3(1.0000029, 0.9999993, 0.9999969)
bones/16/position = Vector3(-0.024605138, 0.08604231, -0.0015067998)
bones/16/rotation = Quaternion(-0.7130364, -0.123598285, 0.029208997, 0.6895284)
bones/16/scale = Vector3(1.0000007, 1.0000008, 0.9999982)
bones/17/rotation = Quaternion(-0.58554816, 0.020785872, -0.009222633, 0.8103186)
bones/17/scale = Vector3(0.99999946, 1.0000049, 0.99999505)
bones/18/rotation = Quaternion(-0.5874686, 0.0038575218, 0.010154042, 0.809174)
bones/18/scale = Vector3(0.99999946, 0.99999636, 1.0000027)
bones/19/position = Vector3(0.0025598723, 0.08686941, 0.0003485831)
bones/19/rotation = Quaternion(-0.45010233, -0.16124822, 0.036844503, 0.8775246)
bones/19/scale = Vector3(1.000001, 0.99999326, 1.0000056)
bones/20/rotation = Quaternion(-0.6457025, 0.0076800776, 0.019753268, 0.76329505)
bones/20/scale = Vector3(0.9999994, 1.0000012, 0.9999983)
bones/21/rotation = Quaternion(-0.6397573, 0.017770112, 0.020346047, 0.7681021)
bones/21/scale = Vector3(0.9999997, 1, 0.99999994)
bones/22/position = Vector3(0.032204367, 0.08342956, -0.0019184119)
bones/22/rotation = Quaternion(-0.42548293, -0.14428787, 0.03901973, 0.8925373)
bones/22/scale = Vector3(1.0000008, 0.99999255, 1.000006)
bones/23/rotation = Quaternion(-0.5835014, -0.0019097773, 0.054007858, 0.8103121)
bones/23/scale = Vector3(0.9999993, 1.0000014, 0.9999982)
bones/24/rotation = Quaternion(-0.5992657, -0.0077646915, 0.029896498, 0.7999542)
bones/24/scale = Vector3(0.99999917, 1.0000015, 0.9999988)
bones/25/rotation = Quaternion(-0.46732152, 0.60981935, -0.507933, -0.38953167)
bones/26/rotation = Quaternion(0.42747992, 0.5223354, 0.367778, 0.63966095)
bones/27/rotation = Quaternion(0.31198776, 0.12637165, 0.23649698, 0.91146207)
bones/27/scale = Vector3(1.0000002, 0.9997524, 0.9999998)
bones/28/rotation = Quaternion(0.057726346, 0.28284425, -0.0069663143, 0.95740193)
bones/28/scale = Vector3(0.9999992, 1.0002446, 1.0000025)
bones/29/position = Vector3(-0.049164493, 0.05008578, -0.0046184924)
bones/29/rotation = Quaternion(0.04647095, -0.78692204, 0.31700882, 0.5273517)
bones/29/scale = Vector3(1.0000135, 0.9999834, 1.0000033)
bones/30/position = Vector3(-4.6574286e-08, 0.0210911, 9.12469e-07)
bones/30/rotation = Quaternion(-0.024224084, -0.30665877, 0.062598675, 0.9494499)
bones/30/scale = Vector3(0.99999, 0.99999493, 1.0000144)
bones/31/rotation = Quaternion(-0.009207489, 0.43871418, 0.008593198, 0.8985385)
bones/31/scale = Vector3(1.0000104, 0.99999964, 0.9999895)
bones/32/position = Vector3(0.024561996, 0.086041234, -0.001475383)
bones/32/rotation = Quaternion(-0.71307796, 0.123773515, -0.028392145, 0.6894881)
bones/32/scale = Vector3(1.000003, 1.0000017, 0.99999434)
bones/33/rotation = Quaternion(-0.58551395, -0.020559972, 0.0093383, 0.81034774)
bones/33/scale = Vector3(1, 1.0000168, 0.99998343)
bones/34/rotation = Quaternion(-0.5874683, -0.0038161273, -0.009851522, 0.8091782)
bones/34/scale = Vector3(0.9999993, 0.99998707, 1.0000128)
bones/35/position = Vector3(-0.0026018997, 0.08686423, 0.00038222718)
bones/35/rotation = Quaternion(-0.4501804, 0.16146435, -0.036355656, 0.8774653)
bones/35/scale = Vector3(1.0000039, 0.99997413, 1.0000206)
bones/36/rotation = Quaternion(-0.64572024, -0.007691401, -0.01944123, 0.7632879)
bones/36/scale = Vector3(0.999998, 1.0000036, 0.99999696)
bones/37/rotation = Quaternion(-0.6397537, -0.01774685, -0.020062046, 0.7681131)
bones/37/scale = Vector3(0.99999976, 0.9999998, 1)
bones/38/position = Vector3(-0.032242596, 0.08342186, -0.0018826793)
bones/38/rotation = Quaternion(-0.4256053, 0.14451644, -0.038539756, 0.89246285)
bones/38/scale = Vector3(1.0000036, 0.9999734, 1.0000226)
bones/39/rotation = Quaternion(-0.58352935, 0.0019344841, -0.05368389, 0.81031346)
bones/39/scale = Vector3(0.99999917, 1.0000048, 0.9999953)
bones/40/rotation = Quaternion(-0.5992753, 0.0078095645, -0.029635748, 0.79995614)
bones/40/scale = Vector3(0.9999981, 1.0000045, 0.99999464)
bones/41/position = Vector3(-0.10189995, -0.02604357, 0.0048768246)
bones/41/rotation = Quaternion(-0.6077498, 0.09655694, 0.78801256, -0.018790418)
bones/41/scale = Vector3(0.999993, 1.0086167, 1)
bones/42/position = Vector3(1.2333298e-07, 0.38935477, -3.9397972e-07)
bones/42/rotation = Quaternion(-1.0652157e-05, -1.4396464e-05, -0.0026065223, 0.99999666)
bones/42/scale = Vector3(0.9999999, 0.999999, 1.0000002)
bones/43/rotation = Quaternion(0.26887715, -0.6126081, 0.28350013, 0.68705475)
bones/43/scale = Vector3(0.9999241, 0.99593246, 0.99564683)
bones/44/position = Vector3(-0.0008844122, 0.12766385, -0.0007816368)
bones/44/scale = Vector3(1.0000137, 0.99589205, 1.004086)
[node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="root/root_001/Skeleton3D" index="1"]
[node name="Physical Bone pelvis" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="0"]
transform = Transform3D(0.23557931, 0.29573935, -0.9257649, 0.93647283, 0.18561544, 0.29759973, 0.25984818, -0.937062, -0.23322468, 0.041481193, 0.23975205, -0.9526674)
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.230214e-05, 0.00050953456, 0.052842658)
body_offset = Transform3D(-0.047264934, 0.24698676, -0.9678655, 1.9326806e-05, 0.9689486, 0.24726215, 0.9988824, 0.011668131, -0.045802116, 0.051014848, -0.013559699, 0.0024965703)
friction = 0.6
bounce = 0.8
bone_name = "pelvis"
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone pelvis" index="0"]
transform = Transform3D(0.9983283, -0.057426687, 0.006551802, 0.009269461, 0.27095735, 0.9625467, -0.0570511, -0.9608768, 0.27103677, -0.026277378, 0.016484857, 0.059847087)
shape = SubResource("CapsuleShape3D_swgnv")
[node name="Physical Bone thigh_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="1"]
transform = Transform3D(0.115132205, 0.98756367, -0.10706323, 0.9848856, -0.099445865, 0.1418127, 0.12940207, -0.12177224, -0.9840867, 0.11195352, 0.1957558, -0.74422055)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2172761e-06, -0.00035805823, 0.1999614)
body_offset = Transform3D(1.0000019, 4.3958426e-07, -2.8312206e-07, -2.0861626e-07, 0.0017459542, -0.9739248, -3.1292439e-07, 1.0000025, 0.0017926535, 1.2740493e-06, 0.19474798, -4.0233135e-07)
friction = 0.6
bounce = 0.8
bone_name = "thigh.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone thigh_l" index="0"]
transform = Transform3D(1, 5.5879354e-09, 0, 2.9802322e-08, 5.5879354e-09, 1, 0, -1.0000001, 1.8626451e-09, 0.0030149072, -0.011125341, 0.0010123253)
shape = SubResource("CapsuleShape3D_pxhot")
[node name="Physical Bone calf_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="2"]
transform = Transform3D(0.11561876, 0.98739123, -0.10812478, 0.98412913, -0.09911851, 0.14719155, 0.13461846, -0.12342684, -0.98318046, 0.15746441, 0.13510402, -0.3316144)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.997093e-05, -2.9877774e-06, 0.21970053)
body_offset = Transform3D(1.0000017, -1.8626451e-07, 0.00027228892, 1.4901161e-08, 8.461066e-06, -0.97392607, 2.9802322e-07, 1.0000043, 1.3328157e-05, 1.4901161e-07, 0.21397206, 5.9604645e-08)
friction = 0.6
bounce = 0.8
bone_name = "calf.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone calf_l" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_rx62r")
[node name="Physical Bone foot_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="3"]
transform = Transform3D(-0.78327715, 0.41593197, -0.46203628, 0.62156075, 0.5380594, -0.5693455, 0.01179397, -0.7331389, -0.67997664, 0.2082249, 0.14071183, -0.06802554)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0029649523, 0.0032675527, 0.06639604)
body_offset = Transform3D(1.0000525, -0.0062685907, -0.0053450763, -1.8060207e-05, -2.7120113e-06, -0.99971634, -1.2457371e-05, 0.99921167, -0.025489092, 0.0033404827, 0.06637716, -0.0015726388)
friction = 0.6
bounce = 0.8
bone_name = "foot.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone foot_l" index="0"]
transform = Transform3D(0.9987839, 0.006565829, -0.048863254, 0.036262766, 0.5736384, 0.8183055, 0.033402696, -0.8190824, 0.5727027, 0.0015807741, 0.0010102019, -0.048480883)
shape = SubResource("CapsuleShape3D_63wjt")
[node name="Physical Bone spine_01" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="4"]
transform = Transform3D(0.99998087, -0.0061568767, 0.0005781364, 0.0061668693, 0.99979556, -0.019257031, -0.000459455, 0.019260228, 0.9998144, -0.0004694978, 0.286528, -1.1610739)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.336061e-05, 0.0010080686, 0.079328224)
body_offset = Transform3D(1.0000001, 3.7629157e-05, -1.868052e-05, -1.8716353e-05, 5.365163e-05, -1.0000001, -3.7651043e-05, 1.0000001, 5.3688884e-05, -6.191665e-05, 0.07932818, -0.0010123253)
friction = 0.6
bounce = 0.8
bone_name = "spine_01"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone spine_01" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_lgsap")
[node name="Physical Bone spine_02" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="5"]
transform = Transform3D(0.99999976, 0.0003205655, 0.00064846966, -0.00039668725, 0.99265003, 0.121020004, -0.0006049085, -0.12102023, 0.9926499, -0.00055574026, 0.27389526, -1.3858926)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.6617953e-07, 0.0011630906, 0.120092124)
body_offset = Transform3D(1.0000002, -2.9773219e-08, -1.614535e-08, -4.605681e-08, 0, -1.0000002, 2.240995e-09, 1.0000002, 3.7252903e-08, -4.642061e-07, 0.12009215, -0.0011630952)
friction = 0.6
bounce = 0.8
bone_name = "spine_02"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone spine_02" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_b8qrq")
[node name="Physical Bone neck_01" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="6"]
transform = Transform3D(0.99990064, 0.014094635, 0.00033012332, -0.012090324, 0.8692853, -0.49416295, -0.0072520175, 0.49410987, 0.86936927, -0.0006395486, 0.2942427, -1.5431339)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00018637997, -0.014062202, 0.044933416)
body_offset = Transform3D(1.0000002, -8.6892396e-07, 5.9138983e-08, 1.9092113e-08, 8.046627e-07, -1.0000002, 8.670613e-07, 1.0000004, 8.940697e-07, -0.0001863949, 0.04493344, 0.014062166)
friction = 0.6
bounce = 0.8
bone_name = "neck_01"
joint_constraints/swing_span = 0.0
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone neck_01" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_ro32m")
[node name="Physical Bone clavicle_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="7"]
transform = Transform3D(-0.2599753, 0.0010889263, -0.9656147, -0.96386755, -0.060431443, 0.2594368, -0.058070976, 0.99817175, 0.016760265, 0.10844983, 0.27126884, -1.3874094)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.816396e-05, -0.06324105, 0.06771886)
body_offset = Transform3D(1, 7.953495e-06, -5.662441e-07, -5.066395e-07, 2.4493784e-06, -1.0000004, -8.028001e-06, 1.0000001, 2.4680048e-06, 9.870529e-05, 0.06771904, 0.063240886)
friction = 0.6
bounce = 0.8
bone_name = "clavicle.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone clavicle_l" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_76ik7")
[node name="Physical Bone upperarm_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="8"]
transform = Transform3D(-0.9329351, 0.09828635, -0.3463696, 0.039213978, 0.9840336, 0.17360926, 0.35790274, 0.14838365, -0.9218936, 0.21919343, 0.23486991, -1.3309096)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5200992e-05, 1.7105516e-06, 0.13099143)
body_offset = Transform3D(1.0000001, 3.4756958e-06, -0.00012059603, -0.0001206235, -1.0639429e-05, -1.0000002, -3.2633543e-06, 1.0000001, -1.0669231e-05, 5.9604645e-07, 0.13099146, -3.1292439e-07)
friction = 0.6
bounce = 0.8
bone_name = "upperarm.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone upperarm_l" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_hp5ob")
[node name="Physical Bone lowerarm_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="9"]
transform = Transform3D(-0.9672625, 0.25236982, 0.026696945, 0.2036231, 0.83457875, -0.511875, -0.1514625, -0.4896813, -0.8586451, 0.26167712, 0.26511794, -1.1211481)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00011695912, 9.264974e-05, 0.10362813)
body_offset = Transform3D(1, 2.7120113e-06, 1.7359853e-05, 1.7531216e-05, 7.3313713e-06, -1.0000694, -2.6524067e-06, 0.9999996, 7.2419643e-06, 0.0001151599, 0.10363531, -9.340048e-05)
friction = 0.6
bounce = 0.8
bone_name = "lowerarm.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone lowerarm_l" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_k82ed")
[node name="Physical Bone hand_l" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="10"]
transform = Transform3D(0.6691953, 0.56012636, 0.48829922, 0.58241284, 0.012744234, -0.8127933, -0.4614899, 0.8283092, -0.31769645, 0.24813288, 0.34279132, -0.99539137)
joint_type = 2
joint_offset = Transform3D(0.9999985, 0, 0, 0, 0.9999985, 0, 0, 0, 0.9999973, 0.009970654, -0.024653021, 0.036958784)
body_offset = Transform3D(0.09434357, -0.70895773, -0.69891346, -5.6922436e-06, 0.7020457, -0.7121323, 0.99554, 0.06717803, 0.06624091, 0.007412374, 0.043627143, -0.010718226)
friction = 0.6
bounce = 0.8
bone_name = "hand.l"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone hand_l" index="0"]
transform = Transform3D(1, 0, 0, 0, 0.6476679, 0.7619228, 0, -0.7619228, 0.6476679, -7.613562e-08, 0.04244047, -0.02025969)
shape = SubResource("CapsuleShape3D_81x62")
[node name="Physical Bone clavicle_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="11"]
transform = Transform3D(-0.25933444, 0.00022785015, 0.9657876, 0.9640336, -0.060179736, 0.25887766, 0.058179826, 0.99818754, 0.015387024, -0.10997537, 0.2745934, -1.4344966)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00038375138, -0.015897889, 0.06801801)
body_offset = Transform3D(1.0000002, 6.7055225e-08, 7.003546e-07, 7.599592e-07, 2.7474016e-07, -1.0000005, 0, 1.0000002, 3.3993274e-07, 0.0003837049, 0.06801805, 0.01589787)
friction = 0.6
bounce = 0.8
bone_name = "clavicle.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone clavicle_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_c87p0")
[node name="Physical Bone upperarm_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="12"]
transform = Transform3D(-0.93345743, -0.09770647, 0.34512427, -0.038921293, 0.9840941, 0.17333175, -0.35657042, 0.14836511, -0.9224128, -0.22026709, 0.23478527, -1.3297559)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00023960909, 9.96516e-05, 0.13182715)
body_offset = Transform3D(1.0000005, -2.7939677e-07, 4.984904e-06, 5.214475e-06, -2.115965e-06, -0.9999998, 1.899898e-07, 1.0000002, -2.2053719e-06, -0.00024026632, 0.13182712, -9.936094e-05)
friction = 0.6
bounce = 0.8
bone_name = "upperarm.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone upperarm_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_wodjd")
[node name="Physical Bone lowerarm_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="13"]
transform = Transform3D(-0.9671382, -0.2526957, -0.028083168, -0.20319527, 0.83458984, -0.51202685, 0.15282491, -0.48949432, -0.85851026, -0.26247418, 0.26537052, -1.1191617)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00021551378, 0.0008159093, 0.10503747)
body_offset = Transform3D(1.0000002, 7.003546e-07, 9.022653e-06, 8.709729e-06, -1.2010336e-05, -1.0002477, -3.874302e-07, 1.0000001, -1.2308359e-05, 0.00021456555, 0.1050635, -0.0008146167)
friction = 0.6
bounce = 0.8
bone_name = "lowerarm.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone lowerarm_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_osl3f")
[node name="Physical Bone hand_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="14"]
transform = Transform3D(0.66987807, -0.55835646, -0.48938882, -0.5825256, 0.013442612, -0.8127012, 0.46035564, 0.8294922, -0.31625208, -0.24704346, 0.338235, -0.9966111)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0130916005, -0.022463894, 0.033371486)
body_offset = Transform3D(0.09433341, 0.7089263, 0.6989468, 1.1473894e-05, 0.7020825, -0.71209544, -0.9955419, 0.06714249, 0.06626114, -0.00616467, 0.039535344, -0.013736188)
friction = 0.6
bounce = 0.8
bone_name = "hand.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone hand_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0.63704735, 0.7708247, 0, -0.7708247, 0.63704735, 3.0209776e-08, 0.050543435, -0.027240014)
shape = SubResource("CapsuleShape3D_tohjf")
[node name="Physical Bone thigh_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="15"]
transform = Transform3D(-0.52638245, -0.84532386, 0.09137322, -0.84425014, 0.5323845, 0.061713077, -0.10081323, -0.044657167, -0.9939026, -0.12298988, 0.27045748, -0.7420706)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0250827e-05, 1.0400772e-05, 0.19637132)
body_offset = Transform3D(1.000007, -7.867813e-06, 1.5124679e-06, 1.4826655e-06, 1.6409904e-05, -0.99145716, 7.927418e-06, 1.0000002, 1.6544014e-05, 9.953976e-06, 0.19469374, -1.3649464e-05)
friction = 0.6
bounce = 0.8
bone_name = "thigh.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone thigh_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_2jrde")
[node name="Physical Bone calf_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="16"]
transform = Transform3D(-0.5259178, -0.84531, 0.0941356, -0.84389925, 0.53240734, 0.0661555, -0.10604038, -0.044648603, -0.9933589, -0.16266069, 0.24147218, -0.31524065)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0011051681, 0.0009728443, 0.23331164)
body_offset = Transform3D(1.0000068, -6.5267086e-06, -8.941442e-05, 9.313226e-08, 7.8231096e-07, -0.9914583, 6.645918e-06, 0.9999999, 1.1511147e-06, 0.0011260435, 0.23131877, -0.00097310543)
friction = 0.6
bounce = 0.8
bone_name = "calf.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone calf_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
shape = SubResource("CapsuleShape3D_hpv8y")
[node name="Physical Bone foot_r" type="PhysicalBone3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D" index="17"]
transform = Transform3D(-0.8927629, 0.33978966, -0.29583353, 0.4504808, 0.68265337, -0.5753708, 0.0064467257, -0.6469369, -0.7625163, -0.16289136, 0.2662114, -0.06912665)
joint_type = 2
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.42822e-05, 0.0005513179, 0.06384036)
body_offset = Transform3D(1.0000451, 0.0007324815, 0.00071302056, -8.940697e-08, -2.0861626e-07, -0.9999136, -2.9802322e-08, 0.99998415, -0.0085531175, -1.6391277e-06, 0.063834846, -5.275011e-06)
friction = 0.6
bounce = 0.8
bone_name = "foot.r"
joint_constraints/swing_span = 19.999992
joint_constraints/twist_span = 19.999992
joint_constraints/bias = 0.3
joint_constraints/softness = 0.8
joint_constraints/relaxation = 1.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="root/root_001/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone foot_r" index="0"]
transform = Transform3D(1, 0, 0, 0, 0.6320293, 0.7749445, 0, -0.7749445, 0.6320293, 1.6763806e-08, -0.0042627603, -0.042318884)
shape = SubResource("CapsuleShape3D_ifqtp")
[node name="ImpactSoundSmall" type="AudioStreamPlayer3D" parent="." index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
stream = SubResource("AudioStreamRandomizer_lgsap")
volume_db = -3.0
unit_size = 15.0
max_db = 0.0
max_polyphony = 4
attenuation_filter_db = 0.0
[node name="ImpactSoundBig" type="AudioStreamPlayer3D" parent="." index="3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
stream = SubResource("AudioStreamRandomizer_pxhot")
volume_db = -3.0
unit_size = 15.0
max_db = 0.0
attenuation_filter_db = 0.0

View File

@@ -0,0 +1,20 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://brpxmsr7g2gh6"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vjigt"]
render_priority = 1
transparency = 1
shading_mode = 0
albedo_color = Color(0, 0, 0, 1)
grow = true
grow_amount = 0.03
stencil_mode = 3
stencil_flags = 1
stencil_compare = 5
metadata/_stencil_owned = true
[resource]
next_pass = SubResource("StandardMaterial3D_vjigt")
albedo_color = Color(0, 0.15095623, 0.30522534, 1)
stencil_mode = 1
stencil_flags = 2
stencil_outline_thickness = 0.03

View File

@@ -0,0 +1,20 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://ch6ctajgm6nyy"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hmx3n"]
render_priority = 1
transparency = 1
shading_mode = 0
albedo_color = Color(0, 0, 0, 1)
grow = true
grow_amount = 0.03
stencil_mode = 3
stencil_flags = 1
stencil_compare = 5
metadata/_stencil_owned = true
[resource]
next_pass = SubResource("StandardMaterial3D_hmx3n")
albedo_color = Color(0.14699998, 0.5218503, 0.98, 1)
stencil_mode = 1
stencil_flags = 2
stencil_outline_thickness = 0.03

View File

@@ -0,0 +1,19 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dyij7l6ir0ixa"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dty5t"]
render_priority = 1
transparency = 1
shading_mode = 0
albedo_color = Color(0, 0, 0, 1)
grow = true
grow_amount = 0.03
stencil_mode = 3
stencil_flags = 1
stencil_compare = 5
metadata/_stencil_owned = true
[resource]
next_pass = SubResource("StandardMaterial3D_dty5t")
stencil_mode = 1
stencil_flags = 2
stencil_outline_thickness = 0.03

View File

@@ -0,0 +1,54 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Ragdoll Physics"
config/description="This demo includes an example of ragdoll simulation for characters."
run/main_scene="uid://dpkhlaxg5302f"
config/features=PackedStringArray("4.5")
[debug]
gdscript/warnings/untyped_declaration=1
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[input]
reset_simulation={
"deadzone": 0.2,
"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":82,"physical_keycode":0,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
]
}
place_ragdoll={
"deadzone": 0.2,
"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":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
slow_motion={
"deadzone": 0.2,
"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":4194325,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[physics]
3d/physics_engine="Jolt Physics"
common/physics_interpolation=true
[rendering]
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=3
textures/default_filters/anisotropic_filtering_level=4
anti_aliasing/quality/msaa_3d=2

Binary file not shown.

View File

@@ -0,0 +1,29 @@
[remap]
importer="2d_array_texture"
type="CompressedTexture2DArray"
uid="uid://ch6sljd8w7yli"
path.bptc="res://.godot/imported/ragdoll_physics.exr-1bc8d749970435786dd413f3313cbc66.bptc.ctexarray"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://ragdoll_physics.exr"
dest_files=["res://.godot/imported/ragdoll_physics.exr-1bc8d749970435786dd413f3313cbc66.bptc.ctexarray"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/channel_pack=1
mipmaps/generate=false
mipmaps/limit=-1
slices/horizontal=1
slices/vertical=1

View File

@@ -0,0 +1,62 @@
extends Node3D
const MOUSE_SENSITIVITY = 0.01
const INITIAL_VELOCITY_STRENGTH = 0.5
# Margin to add to the automatically computed shadow maximum distance.
# This value was empirically chosen to cover the whole scene when zoomed
# all the way in.
const DIRECTIONAL_SHADOW_MAX_DISTANCE_MARGIN = 9.0
@onready var camera_pivot: Node3D = $CameraPivot
@onready var camera: Camera3D = $CameraPivot/Camera3D
@onready var directional_light: DirectionalLight3D = $DirectionalLight3D
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed(&"reset_simulation"):
get_tree().reload_current_scene()
if event.is_action_pressed(&"place_ragdoll"):
var origin := camera.global_position
var target := camera.project_position(get_viewport().get_mouse_position(), 100)
var query := PhysicsRayQueryParameters3D.create(origin, target)
var result := camera.get_world_3d().direct_space_state.intersect_ray(query)
if not result.is_empty():
var ragdoll := preload("res://characters/mannequiny_ragdoll.tscn").instantiate()
ragdoll.position = result["position"] + Vector3(0.0, 0.5, 0.0)
# Make newly spawned ragdolls face the camera.
ragdoll.rotation.y = camera_pivot.rotation.y
# Give some initial velocity in a random horizontal direction.
ragdoll.initial_velocity = Vector3.FORWARD.rotated(Vector3.UP, randf_range(0, TAU)) * INITIAL_VELOCITY_STRENGTH
add_child(ragdoll)
if event.is_action_pressed(&"slow_motion"):
Engine.time_scale = 0.25
# Don't set pitch scale too low as it sounds strange.
# `0.5` is the square root of `0.25` and gives a good result here.
AudioServer.playback_speed_scale = 0.5
if event.is_action_released(&"slow_motion"):
Engine.time_scale = 1.0
AudioServer.playback_speed_scale = 1.0
# Pan the camera with right mouse button.
if event is InputEventMouseMotion:
var mouse_motion := event as InputEventMouseMotion
if mouse_motion.button_mask & MOUSE_BUTTON_RIGHT:
camera_pivot.global_rotation.x = clampf(camera_pivot.global_rotation.x - event.screen_relative.y * MOUSE_SENSITIVITY, -TAU * 0.249, TAU * 0.021)
camera_pivot.global_rotation.y -= event.screen_relative.x * MOUSE_SENSITIVITY
# Zoom with mouse wheel.
# This also adjusts shadow maximum distance to always cover the scene regardless of zoom level.
if event is InputEventMouseButton:
var mouse_button := event as InputEventMouseButton
if mouse_button.button_index == MOUSE_BUTTON_WHEEL_UP:
camera.translate_object_local(Vector3.FORWARD * 0.5)
directional_light.directional_shadow_max_distance = camera.position.length() + DIRECTIONAL_SHADOW_MAX_DISTANCE_MARGIN
elif mouse_button.button_index == MOUSE_BUTTON_WHEEL_DOWN:
camera.translate_object_local(Vector3.BACK * 0.5)
directional_light.directional_shadow_max_distance = camera.position.length() + DIRECTIONAL_SHADOW_MAX_DISTANCE_MARGIN

View File

@@ -0,0 +1 @@
uid://bahoxmy18mw7s

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

View File

@@ -0,0 +1,8 @@
# License for `impact_big.wav`
Copyright (c) 2020 FFeller
Licensed under CC0 1.0 Universal.
Downloaded from <https://freesound.org/people/FFeller/sounds/532873/>.
Sound edited to remove silence at the start for lower latency on playback.

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://urcgf5c0ln36"
path="res://.godot/imported/impact_big.wav-4c74cd797c68f16630acca36ff277f21.sample"
[deps]
source_file="res://sounds/impact_big.wav"
dest_files=["res://.godot/imported/impact_big.wav-4c74cd797c68f16630acca36ff277f21.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -0,0 +1,8 @@
# License for `impact_small.wav`
Copyright (c) 2017 dorian.mastin
Licensed under CC0 1.0 Universal.
Downloaded from <https://freesound.org/people/dorian.mastin/sounds/381626/>.
Sound edited to remove silence at the start for lower latency on playback.

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://drrptt1g0n2vh"
path="res://.godot/imported/impact_small.wav-445e8ba44ed650ede07371ef928d7204.sample"
[deps]
source_file="res://sounds/impact_small.wav"
dest_files=["res://.godot/imported/impact_small.wav-445e8ba44ed650ede07371ef928d7204.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -0,0 +1,7 @@
# License for `checker.png`
Copyright (c) 2020 Kenney
Licensed under CC0 1.0 Universal.
Downloaded from https://kenney.nl/assets/prototype-textures

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cjdn0ljnq03m4"
path.s3tc="res://.godot/imported/checker.png-d334a8ae07de292fd4162f184b9dd7bc.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/checker.png"
dest_files=["res://.godot/imported/checker.png-d334a8ae07de292fd4162f184b9dd7bc.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0