mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 05:20:06 +01:00
Rename RigidBody -> RigidDynamicBody
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
extends RigidBody2D
|
||||
extends RigidDynamicBody2D
|
||||
|
||||
func _ready():
|
||||
$AnimatedSprite2D.playing = true
|
||||
|
||||
@@ -30,7 +30,7 @@ animations = [{
|
||||
radius = 35.2706
|
||||
height = 23.3281
|
||||
|
||||
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
|
||||
[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
@@ -8,7 +8,7 @@ bounce = 0.4
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 30.0
|
||||
|
||||
[node name="Ball" type="RigidBody2D"]
|
||||
[node name="Ball" type="RigidDynamicBody2D"]
|
||||
physics_material_override = SubResource( 1 )
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Physics Platformer
|
||||
|
||||
This demo uses [`RigidBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigidbody2d.html)
|
||||
This demo uses [`RigidDynamicBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigiddynamicbody2d.html)
|
||||
for the player and enemies.
|
||||
These character controllers are more powerful than
|
||||
[`KinematicBody2D`](https://docs.godotengine.org/en/latest/classes/class_kinematicbody2d.html),
|
||||
but can be more difficult to handle, as they require
|
||||
manual modification of the RigidBody velocity.
|
||||
manual modification of the RigidDynamicBody velocity.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
@@ -17,7 +17,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/
|
||||
|
||||
The player and enemies use dynamic character
|
||||
controllers for movement, made with
|
||||
[`RigidBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigidbody2d.html),
|
||||
[`RigidDynamicBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigiddynamicbody2d.html),
|
||||
which means that they can perfectly interact with physics
|
||||
(there is a see-saw, and you can even ride enemies).
|
||||
Because of this, all movement must be done in sync with
|
||||
|
||||
@@ -11,7 +11,7 @@ extents = Vector2(8, 13.5)
|
||||
|
||||
[node name="Seesaw" type="Node2D"]
|
||||
|
||||
[node name="Plank" type="RigidBody2D" parent="."]
|
||||
[node name="Plank" type="RigidDynamicBody2D" parent="."]
|
||||
mass = 5.10204
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Plank"]
|
||||
|
||||
@@ -106,7 +106,7 @@ radius = 7.0
|
||||
offsets = PackedFloat32Array(0.5, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0.501961, 0, 0, 0, 0)
|
||||
|
||||
[node name="Enemy" type="RigidBody2D"]
|
||||
[node name="Enemy" type="RigidDynamicBody2D"]
|
||||
mode = 2
|
||||
physics_material_override = SubResource( 1 )
|
||||
contacts_reported = 4
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class_name Enemy
|
||||
extends RigidBody2D
|
||||
extends RigidDynamicBody2D
|
||||
|
||||
const WALK_SPEED = 50
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[node name="MovingPlatform" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Platform" type="RigidBody2D" parent="."]
|
||||
[node name="Platform" type="RigidDynamicBody2D" parent="."]
|
||||
mode = 3
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Platform"]
|
||||
|
||||
@@ -14,4 +14,4 @@ func _physics_process(delta):
|
||||
var xf = Transform2D()
|
||||
|
||||
xf[2]= motion * d
|
||||
($Platform as RigidBody2D).transform = xf
|
||||
($Platform as RigidDynamicBody2D).transform = xf
|
||||
|
||||
@@ -50,7 +50,7 @@ tracks/2/keys = {
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[node name="Bullet" type="RigidBody2D"]
|
||||
[node name="Bullet" type="RigidDynamicBody2D"]
|
||||
continuous_cd = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ tracks/0/keys = {
|
||||
custom_solver_bias = 0.5
|
||||
length = 18.0
|
||||
|
||||
[node name="Player" type="RigidBody2D"]
|
||||
[node name="Player" type="RigidDynamicBody2D"]
|
||||
mode = 2
|
||||
mass = 1.5
|
||||
physics_material_override = SubResource( 1 )
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class_name Bullet
|
||||
extends RigidBody2D
|
||||
extends RigidDynamicBody2D
|
||||
|
||||
var disabled = false
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class_name Player
|
||||
extends RigidBody2D
|
||||
extends RigidDynamicBody2D
|
||||
|
||||
# Character Demo, written by Juan Linietsky.
|
||||
#
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[{
|
||||
"base": "RigidBody2D",
|
||||
"base": "RigidDynamicBody2D",
|
||||
"class": &"Bullet",
|
||||
"language": &"GDScript",
|
||||
"path": "res://player/bullet.gd"
|
||||
@@ -19,7 +19,7 @@ _global_script_classes=[{
|
||||
"language": &"GDScript",
|
||||
"path": "res://coin/coin.gd"
|
||||
}, {
|
||||
"base": "RigidBody2D",
|
||||
"base": "RigidDynamicBody2D",
|
||||
"class": &"Enemy",
|
||||
"language": &"GDScript",
|
||||
"path": "res://enemy/enemy.gd"
|
||||
@@ -29,7 +29,7 @@ _global_script_classes=[{
|
||||
"language": &"GDScript",
|
||||
"path": "res://platform/moving_platform.gd"
|
||||
}, {
|
||||
"base": "RigidBody2D",
|
||||
"base": "RigidDynamicBody2D",
|
||||
"class": &"Player",
|
||||
"language": &"GDScript",
|
||||
"path": "res://player/player.gd"
|
||||
@@ -45,10 +45,10 @@ _global_script_class_icons={
|
||||
[application]
|
||||
|
||||
config/name="Physics-Based Platformer 2D"
|
||||
config/description="This demo uses RigidBody2D for the player and enemies. These
|
||||
config/description="This demo uses RigidDynamicBody2D for the player and enemies. These
|
||||
character controllers are more powerful than CharacterBody2D,
|
||||
but can be more difficult to handle, as they require
|
||||
manual modification of the RigidBody3D velocity."
|
||||
manual modification of the RigidDynamicBody3D velocity."
|
||||
run/main_scene="res://Stage.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func _ready():
|
||||
var enabled = _body_type == E_BodyType.CHARACTER_BODY_RAY
|
||||
options.add_menu_item(OPTION_OBJECT_TYPE_CHARACTER_RAY, true, enabled, true)
|
||||
|
||||
_rigid_body_template = find_node("RigidBody2D")
|
||||
_rigid_body_template = find_node("RigidDynamicBody2D")
|
||||
if _rigid_body_template:
|
||||
_body_parent = _rigid_body_template.get_parent()
|
||||
_body_parent.remove_child(_rigid_body_template)
|
||||
|
||||
@@ -74,7 +74,7 @@ shape = SubResource( "RectangleShape2D_scs3g" )
|
||||
position = Vector2(0, -2)
|
||||
shape = SubResource( "SeparationRayShape2D_vby12" )
|
||||
|
||||
[node name="RigidBody2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"]
|
||||
[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"]
|
||||
position = Vector2(30, 40)
|
||||
collision_mask = 2147483649
|
||||
physics_material_override = SubResource( "1" )
|
||||
@@ -83,7 +83,7 @@ contact_monitor = true
|
||||
lock_rotation = true
|
||||
script = ExtResource( "2" )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidDynamicBody2D"]
|
||||
shape = SubResource( "2" )
|
||||
|
||||
[node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"]
|
||||
|
||||
@@ -123,7 +123,7 @@ shape = SubResource( "CircleShape2D_llvur" )
|
||||
position = Vector2(0, -16)
|
||||
shape = SubResource( "RayShape2D_3lv1w" )
|
||||
|
||||
[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
position = Vector2(100, 450)
|
||||
collision_mask = 2147483649
|
||||
physics_material_override = SubResource( "1" )
|
||||
@@ -132,7 +132,7 @@ contact_monitor = true
|
||||
lock_rotation = true
|
||||
script = ExtResource( "6" )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"]
|
||||
shape = SubResource( "2" )
|
||||
|
||||
[node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="."]
|
||||
|
||||
@@ -87,7 +87,7 @@ shape = SubResource( "RayShape2D_206f5" )
|
||||
position = Vector2(12, 8)
|
||||
shape = SubResource( "RayShape2D_206f5" )
|
||||
|
||||
[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
position = Vector2(250, 460)
|
||||
collision_mask = 2147483649
|
||||
physics_material_override = SubResource( "1" )
|
||||
@@ -96,7 +96,7 @@ contact_monitor = true
|
||||
lock_rotation = true
|
||||
script = ExtResource( "6" )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"]
|
||||
shape = SubResource( "2" )
|
||||
|
||||
[node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="."]
|
||||
|
||||
@@ -91,7 +91,7 @@ func _ready():
|
||||
_target_area.connect(&"body_entered", Callable(self, "_on_target_entered"))
|
||||
$Timer.connect(&"timeout", Callable(self, "_on_timeout"))
|
||||
|
||||
_rigid_body_template = $RigidBody2D
|
||||
_rigid_body_template = $RigidDynamicBody2D
|
||||
remove_child(_rigid_body_template)
|
||||
|
||||
_character_body_template = $CharacterBody2D
|
||||
@@ -190,7 +190,7 @@ func _update_rigidbody_angle(value, reset = true):
|
||||
_body_angle = value
|
||||
if is_inside_tree():
|
||||
if Engine.is_editor_hint():
|
||||
$RigidBody2D.rotation = deg2rad(value)
|
||||
$RigidDynamicBody2D.rotation = deg2rad(value)
|
||||
$CharacterBody2D.rotation = deg2rad(value)
|
||||
else:
|
||||
if _moving_body:
|
||||
|
||||
@@ -205,19 +205,19 @@ position = Vector2(512, 300)
|
||||
shape = SubResource( "2" )
|
||||
one_way_collision = true
|
||||
|
||||
[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."]
|
||||
position = Vector2(300, 300)
|
||||
collision_mask = 2147483649
|
||||
gravity_scale = 0.0
|
||||
contacts_reported = 1
|
||||
contact_monitor = true
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="RigidBody2D"]
|
||||
[node name="Sprite" type="Sprite2D" parent="RigidDynamicBody2D"]
|
||||
self_modulate = Color(1, 1, 1, 0.501961)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource( "2" )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"]
|
||||
shape = SubResource( "3" )
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
|
||||
@@ -14,7 +14,7 @@ _global_script_classes=[{
|
||||
"language": &"GDScript",
|
||||
"path": "res://src/Actors/Actor.gd"
|
||||
}, {
|
||||
"base": "RigidBody2D",
|
||||
"base": "RigidDynamicBody2D",
|
||||
"class": &"Bullet",
|
||||
"language": &"GDScript",
|
||||
"path": "res://src/Objects/Bullet.gd"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class_name Bullet
|
||||
extends RigidBody2D
|
||||
extends RigidDynamicBody2D
|
||||
|
||||
|
||||
@onready var animation_player = $AnimationPlayer
|
||||
|
||||
@@ -55,7 +55,7 @@ tracks/2/keys = {
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[node name="Bullet" type="RigidBody2D"]
|
||||
[node name="Bullet" type="RigidDynamicBody2D"]
|
||||
material = SubResource( 1 )
|
||||
collision_layer = 0
|
||||
collision_mask = 26
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends RigidBody3D
|
||||
extends RigidDynamicBody3D
|
||||
|
||||
const DESPAWN_TIME = 5
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ emission_on_uv2 = false
|
||||
[sub_resource type="SphereShape3D" id=4]
|
||||
radius = 0.4
|
||||
|
||||
[node name="SimpleBullet" type="RigidBody3D"]
|
||||
[node name="SimpleBullet" type="RigidDynamicBody3D"]
|
||||
mass = 2.0
|
||||
physics_material_override = SubResource( 1 )
|
||||
gravity_scale = 3.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends RigidBody3D
|
||||
extends RigidDynamicBody3D
|
||||
|
||||
const ACCEL = 5.0
|
||||
const DEACCEL = 20.0
|
||||
|
||||
@@ -484,7 +484,7 @@ material = SubResource( 15 )
|
||||
max_value = 3.0
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.0349232, 2.1123), 0.0, 0.0, 0, 0, Vector2(0.151192, 0.823242), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
|
||||
[node name="Enemy" type="RigidBody3D"]
|
||||
[node name="Enemy" type="RigidDynamicBody3D"]
|
||||
mode = 2
|
||||
physics_material_override = SubResource( 1 )
|
||||
custom_integrator = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends RigidBody3D
|
||||
extends RigidDynamicBody3D
|
||||
|
||||
#warning-ignore:unused_class_variable
|
||||
var enabled = true
|
||||
|
||||
@@ -82,7 +82,7 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
[sub_resource type="SphereShape3D" id=6]
|
||||
radius = 0.27
|
||||
|
||||
[node name="Bullet" type="RigidBody3D"]
|
||||
[node name="Bullet" type="RigidDynamicBody3D"]
|
||||
mass = 0.4
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
|
||||
@@ -15,7 +15,7 @@ func _ready():
|
||||
# Find collision exceptions for ray.
|
||||
var node = self
|
||||
while node:
|
||||
if node is RigidBody3D:
|
||||
if node is RigidDynamicBody3D:
|
||||
collision_exception.append(node.get_rid())
|
||||
break
|
||||
else:
|
||||
|
||||
@@ -15,7 +15,7 @@ roughness = 0.75
|
||||
material = SubResource( 3 )
|
||||
size = Vector3(1, 1, 1)
|
||||
|
||||
[node name="cube_rigidbody" type="RigidBody3D"]
|
||||
[node name="cube_rigidbody" type="RigidDynamicBody3D"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends RigidBody3D
|
||||
extends RigidDynamicBody3D
|
||||
|
||||
@onready var raycast = $RayCast3D
|
||||
@onready var camera = $Target/Camera3D
|
||||
|
||||
@@ -12,7 +12,7 @@ mid_height = 0.7
|
||||
radius = 0.5
|
||||
height = 0.7
|
||||
|
||||
[node name="RigidBody3D" type="RigidBody3D"]
|
||||
[node name="RigidDynamicBody3D" type="RigidDynamicBody3D"]
|
||||
can_sleep = false
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
|
||||
@@ -10,7 +10,7 @@ config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
config/name="RigidBody3D Character 3D"
|
||||
config/name="RigidDynamicBody3D Character 3D"
|
||||
config/description="Rigidbody character demo for 3D using a capsule for the character.
|
||||
"
|
||||
run/main_scene="res://level.tscn"
|
||||
|
||||
@@ -11,7 +11,7 @@ func _ready():
|
||||
# Find collision exceptions for ray.
|
||||
var node = self
|
||||
while(node):
|
||||
if (node is RigidBody3D):
|
||||
if (node is RigidDynamicBody3D):
|
||||
collision_exception.append(node.get_rid())
|
||||
break
|
||||
else:
|
||||
|
||||
@@ -347,7 +347,7 @@ shape = SubResource( 6 )
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
_import_path = NodePath("AnimationPlayer")
|
||||
|
||||
[node name="ChainB1" type="RigidBody3D" parent="."]
|
||||
[node name="ChainB1" type="RigidDynamicBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 1.12554, -1.54623)
|
||||
|
||||
[node name="Chain1" type="MeshInstance3D" parent="ChainB1"]
|
||||
@@ -361,7 +361,7 @@ surface_material_override/0 = null
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="ChainB2" type="RigidBody3D" parent="."]
|
||||
[node name="ChainB2" type="RigidDynamicBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.803378, -1.75806)
|
||||
|
||||
[node name="Chain1" type="MeshInstance3D" parent="ChainB2"]
|
||||
@@ -375,7 +375,7 @@ surface_material_override/0 = null
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="ChainB3" type="RigidBody3D" parent="."]
|
||||
[node name="ChainB3" type="RigidDynamicBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.490045, -1.96106)
|
||||
|
||||
[node name="Chain1" type="MeshInstance3D" parent="ChainB3"]
|
||||
@@ -389,7 +389,7 @@ surface_material_override/0 = null
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="ChainB4" type="RigidBody3D" parent="."]
|
||||
[node name="ChainB4" type="RigidDynamicBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.447167, -0.894451, 0, 0.894451, 0.447167, 0, 0.290326, -2.19413)
|
||||
|
||||
[node name="Chain1" type="MeshInstance3D" parent="ChainB4"]
|
||||
@@ -403,7 +403,7 @@ surface_material_override/0 = null
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="ChainB5" type="RigidBody3D" parent="."]
|
||||
[node name="ChainB5" type="RigidDynamicBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.0993884, -0.995049, 0, 0.995049, 0.0993884, 0, 0.205717, -2.50193)
|
||||
|
||||
[node name="Chain1" type="MeshInstance3D" parent="ChainB5"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Mob : RigidBody2D
|
||||
public partial class Mob : RigidDynamicBody2D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ animations = [{
|
||||
radius = 35.8898
|
||||
height = 29.3103
|
||||
|
||||
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
|
||||
[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
Reference in New Issue
Block a user