Merge pull request #695 from aaronfranke/gd4-rigidbody-sname

Rename RigidBody -> RigidDynamicBody and use StringName literals
This commit is contained in:
Aaron Franke
2022-03-28 01:31:38 -05:00
committed by GitHub
72 changed files with 180 additions and 180 deletions

View File

@@ -1,4 +1,4 @@
extends RigidBody2D
extends RigidDynamicBody2D
func _ready():
$AnimatedSprite2D.playing = true

View File

@@ -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 )

View File

@@ -12,13 +12,13 @@ func _ready():
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed("move_left"):
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed("move_down"):
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed("move_up"):
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:

View File

@@ -22,7 +22,7 @@ func update(_delta):
emit_signal("finished", "idle")
update_look_direction(input_direction)
if Input.is_action_pressed("run"):
if Input.is_action_pressed(&"run"):
speed = max_run_speed
else:
speed = max_walk_speed

View File

@@ -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="."]

View File

@@ -30,5 +30,5 @@ func _physics_process(delta):
move_and_slide()
# Check for jumping. is_on_floor() must be called after movement code.
if is_on_floor() and Input.is_action_just_pressed("jump"):
if is_on_floor() and Input.is_action_just_pressed(&"jump"):
velocity.y = -JUMP_SPEED

View File

@@ -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

View File

@@ -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"]

View File

@@ -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

View File

@@ -1,5 +1,5 @@
class_name Enemy
extends RigidBody2D
extends RigidDynamicBody2D
const WALK_SPEED = 50

View File

@@ -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"]

View File

@@ -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

View File

@@ -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 )

View File

@@ -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 )

View File

@@ -1,5 +1,5 @@
class_name Bullet
extends RigidBody2D
extends RigidDynamicBody2D
var disabled = false

View File

@@ -1,5 +1,5 @@
class_name Player
extends RigidBody2D
extends RigidDynamicBody2D
# Character Demo, written by Juan Linietsky.
#
@@ -62,11 +62,11 @@ func _integrate_forces(s):
var new_siding_left = siding_left
# Get player input.
var move_left = Input.is_action_pressed("move_left")
var move_right = Input.is_action_pressed("move_right")
var jump = Input.is_action_pressed("jump")
var shoot = Input.is_action_pressed("shoot")
var spawn = Input.is_action_pressed("spawn")
var move_left = Input.is_action_pressed(&"move_left")
var move_right = Input.is_action_pressed(&"move_right")
var jump = Input.is_action_pressed(&"jump")
var shoot = Input.is_action_pressed(&"shoot")
var spawn = Input.is_action_pressed(&"spawn")
if spawn:
call_deferred("_spawn_enemy_above")

View File

@@ -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"

View File

@@ -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)

View File

@@ -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"]

View File

@@ -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="."]

View File

@@ -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="."]

View File

@@ -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
@@ -105,7 +105,7 @@ func _ready():
func _process(_delta):
if not Engine.is_editor_hint():
if Input.is_action_just_pressed("ui_accept"):
if Input.is_action_just_pressed(&"ui_accept"):
await _reset_test(false)
@@ -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:

View File

@@ -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="."]

View File

@@ -17,7 +17,7 @@ func _ready():
func _process(_delta):
if Input.is_action_just_pressed("restart_test"):
if Input.is_action_just_pressed(&"restart_test"):
if _current_test:
_start_test(_current_test)

View File

@@ -27,12 +27,12 @@ func _physics_process(_delta):
_velocity.x = 0.0
# Handle horizontal controls.
if Input.is_action_pressed("character_left"):
if Input.is_action_pressed(&"character_left"):
if position.x > 0.0:
_velocity.x = -_motion_speed
_keep_velocity = false
_constant_velocity = Vector2.ZERO
elif Input.is_action_pressed("character_right"):
elif Input.is_action_pressed(&"character_right"):
if position.x < 1024.0:
_velocity.x = _motion_speed
_keep_velocity = false
@@ -40,7 +40,7 @@ func _physics_process(_delta):
# Handle jump controls and gravity.
if is_on_floor():
if not _jumping and Input.is_action_just_pressed("character_jump"):
if not _jumping and Input.is_action_just_pressed(&"character_jump"):
# Start jumping.
_jumping = true
_velocity.y = -_jump_force

View File

@@ -27,12 +27,12 @@ func _physics_process(_delta):
_velocity.x = 0.0
# Handle horizontal controls.
if Input.is_action_pressed("character_left"):
if Input.is_action_pressed(&"character_left"):
if position.x > 0.0:
_velocity.x = -_motion_speed
_keep_velocity = false
_constant_velocity = Vector2.ZERO
elif Input.is_action_pressed("character_right"):
elif Input.is_action_pressed(&"character_right"):
if position.x < 1024.0:
_velocity.x = _motion_speed
_keep_velocity = false
@@ -40,7 +40,7 @@ func _physics_process(_delta):
# Handle jump controls and gravity.
if is_on_floor():
if not _jumping and Input.is_action_just_pressed("character_jump"):
if not _jumping and Input.is_action_just_pressed(&"character_jump"):
# Start jumping.
_jumping = true
_velocity.y = -_jump_force

View File

@@ -25,13 +25,13 @@ func _enter_tree():
func _process(_delta):
if Input.is_action_just_pressed("toggle_full_screen"):
if Input.is_action_just_pressed(&"toggle_full_screen"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
if Input.is_action_just_pressed("toggle_debug_collision"):
if Input.is_action_just_pressed(&"toggle_debug_collision"):
var debug_collision_enabled = not _is_debug_collision_enabled()
_set_debug_collision_enabled(debug_collision_enabled)
if debug_collision_enabled:
@@ -39,10 +39,10 @@ func _process(_delta):
else:
Log.print_log("Debug Collision OFF")
if Input.is_action_just_pressed("toggle_pause"):
if Input.is_action_just_pressed(&"toggle_pause"):
get_tree().paused = not get_tree().paused
if Input.is_action_just_pressed("exit"):
if Input.is_action_just_pressed(&"exit"):
get_tree().quit()

View File

@@ -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"

View File

@@ -1,5 +1,5 @@
class_name Bullet
extends RigidBody2D
extends RigidDynamicBody2D
@onready var animation_player = $AnimationPlayer

View File

@@ -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

View File

@@ -33,7 +33,7 @@ func _physics_process(delta):
no_move_horizontal_time -= delta
else:
velocity.x = (Input.get_axis(&"move_left", &"move_right")) * speed.x
if Input.is_action_pressed("walk"):
if Input.is_action_pressed(&"walk"):
velocity.x *= 0.2
#warning-ignore:return_value_discarded
# TODO: This information should be set to the CharacterBody properties instead of arguments: , Vector2.UP
@@ -58,7 +58,7 @@ func _physics_process(delta):
elif falling_slow:
$AnimationTree["parameters/land/active"] = true
falling_slow = false
if Input.is_action_just_pressed("jump"):
if Input.is_action_just_pressed(&"jump"):
$AnimationTree["parameters/jump/active"] = true
velocity.y = -speed.y
if abs(velocity.x) > 50:

View File

@@ -71,7 +71,7 @@ func _ready():
if get_tree().edited_scene_root != null:
target.set_owner(get_tree().edited_scene_root)
target.name = "Target"
target.name = &"Target"
else:
target = $Target
@@ -89,7 +89,7 @@ func _ready():
if get_tree().edited_scene_root != null:
middle_joint_target.set_owner(get_tree().edited_scene_root)
middle_joint_target.name = "MiddleJoint"
middle_joint_target.name = &"MiddleJoint"
else:
middle_joint_target = get_node(^"MiddleJoint")
@@ -366,7 +366,7 @@ func _make_editor_sphere_at_node(node, color):
# Add it as our child, and name it
var indicator = MeshInstance3D.new()
node.add_child(indicator)
indicator.name = "(EditorOnly) Visual indicator"
indicator.name = &"(EditorOnly) Visual indicator"
# We need to make a mesh for the mesh instance.
# The code below makes a small sphere mesh

View File

@@ -142,7 +142,7 @@ func _setup_for_editor():
# add it as a child of this node, and name it.
_editor_indicator = MeshInstance3D.new()
add_child(_editor_indicator)
_editor_indicator.name = "(EditorOnly) Visual indicator"
_editor_indicator.name = &"(EditorOnly) Visual indicator"
# Make a sphere mesh for the MeshInstance3D
var indicator_mesh = SphereMesh.new()

View File

@@ -87,7 +87,7 @@ func process_input(delta):
if Input.is_key_pressed(KEY_RIGHT) or Input.is_key_pressed(KEY_D):
dir += cam_xform.basis[0]
if Input.is_action_just_pressed("ui_cancel"):
if Input.is_action_just_pressed(&"ui_cancel"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:

View File

@@ -1,4 +1,4 @@
extends RigidBody3D
extends RigidDynamicBody3D
const DESPAWN_TIME = 5

View File

@@ -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

View File

@@ -11,9 +11,9 @@ const DECELERATION = 4
var velocity: Vector3
func _physics_process(delta):
if Input.is_action_just_pressed("exit"):
if Input.is_action_just_pressed(&"exit"):
get_tree().quit()
if Input.is_action_just_pressed("reset_position"):
if Input.is_action_just_pressed(&"reset_position"):
position = start_position
var dir = Vector3()
@@ -55,7 +55,7 @@ func _physics_process(delta):
# TODO: This information should be set to the CharacterBody properties instead of arguments.
# Jumping code. is_on_floor() must come after move_and_slide().
if is_on_floor() and Input.is_action_pressed("jump"):
if is_on_floor() and Input.is_action_pressed(&"jump"):
velocity.y = JUMP_SPEED

View File

@@ -17,7 +17,7 @@ func _ready():
func _process(_delta):
if Input.is_action_just_pressed("restart_test"):
if Input.is_action_just_pressed(&"restart_test"):
if _current_test:
_start_test(_current_test)

View File

@@ -28,13 +28,13 @@ func _enter_tree():
func _process(_delta):
if Input.is_action_just_pressed("toggle_full_screen"):
if Input.is_action_just_pressed(&"toggle_full_screen"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
if Input.is_action_just_pressed("toggle_debug_collision"):
if Input.is_action_just_pressed(&"toggle_debug_collision"):
var debug_collision_enabled = not _is_debug_collision_enabled()
_set_debug_collision_enabled(debug_collision_enabled)
if debug_collision_enabled:
@@ -42,10 +42,10 @@ func _process(_delta):
else:
Log.print_log("Debug Collision OFF")
if Input.is_action_just_pressed("toggle_pause"):
if Input.is_action_just_pressed(&"toggle_pause"):
get_tree().paused = not get_tree().paused
if Input.is_action_just_pressed("exit"):
if Input.is_action_just_pressed(&"exit"):
get_tree().quit()

View File

@@ -1,4 +1,4 @@
extends RigidBody3D
extends RigidDynamicBody3D
const ACCEL = 5.0
const DEACCEL = 20.0

View File

@@ -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

View File

@@ -1,4 +1,4 @@
extends RigidBody3D
extends RigidDynamicBody3D
#warning-ignore:unused_class_variable
var enabled = true

View File

@@ -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__ = {

View File

@@ -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:

View File

@@ -49,8 +49,8 @@ func _physics_process(delta):
dir.y = 0
dir = dir.normalized()
var jump_attempt = Input.is_action_pressed("jump")
var shoot_attempt = Input.is_action_pressed("shoot")
var jump_attempt = Input.is_action_pressed(&"jump")
var shoot_attempt = Input.is_action_pressed(&"shoot")
if is_on_floor():
var sharp_turn = hspeed > 0.1 and rad2deg(acos(dir.dot(hdir))) > SHARP_TURN_THRESHOLD

View File

@@ -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 )

View File

@@ -1,13 +1,13 @@
extends RigidBody3D
extends RigidDynamicBody3D
@onready var raycast = $RayCast3D
@onready var camera = $Target/Camera3D
@onready var start_position = position
func _physics_process(_delta):
if Input.is_action_just_pressed("exit"):
if Input.is_action_just_pressed(&"exit"):
get_tree().quit()
if Input.is_action_just_pressed("reset_position"):
if Input.is_action_just_pressed(&"reset_position"):
position = start_position
return
@@ -24,7 +24,7 @@ func _physics_process(_delta):
apply_central_impulse(dir.normalized() / 10)
# Jumping code.
if on_ground() and Input.is_action_pressed("jump"):
if on_ground() and Input.is_action_pressed(&"jump"):
apply_central_impulse(Vector3.UP)

View File

@@ -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

View File

@@ -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"

View File

@@ -3,13 +3,13 @@ extends Control
var town = null
func _process(_delta):
if Input.is_action_just_pressed("back"):
if Input.is_action_just_pressed(&"back"):
_on_Back_pressed()
func _load_scene(car):
var tt = load(car).instantiate()
tt.set_name("car")
tt.name = &"car"
town = load("res://town_scene.tscn").instantiate()
town.get_node(^"InstancePos").add_child(tt)
town.get_node(^"Back").connect(&"pressed", self._on_Back_pressed)

View File

@@ -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:

View File

@@ -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"]

View File

@@ -13,7 +13,7 @@ func _physics_process(delta):
steer_target = Input.get_axis(&"turn_right", &"turn_left")
steer_target *= STEER_LIMIT
if Input.is_action_pressed("accelerate"):
if Input.is_action_pressed(&"accelerate"):
# Increase engine force at low speeds to make the initial acceleration faster.
var speed = linear_velocity.length()
if speed < 5 and speed != 0:
@@ -23,7 +23,7 @@ func _physics_process(delta):
else:
engine_force = 0
if Input.is_action_pressed("reverse"):
if Input.is_action_pressed(&"reverse"):
# Increase engine force at low speeds to make the initial acceleration faster.
if fwd_mps >= -1:
var speed = linear_velocity.length()

View File

@@ -6,7 +6,7 @@ extends Label
func _process(_delta):
if Input.is_action_just_pressed("debug"):
if Input.is_action_just_pressed(&"debug"):
visible = not visible
text = "Position: " + _vector_to_string_appropriate_digits(player.transform.origin)

View File

@@ -9,7 +9,7 @@ extends Control
func _process(_delta):
if Input.is_action_just_pressed("pause"):
if Input.is_action_just_pressed(&"pause"):
pause.visible = crosshair.visible
crosshair.visible = not crosshair.visible
options.visible = false

View File

@@ -26,15 +26,15 @@ func _process(_delta):
# Block selection.
var ray_position = raycast.get_collision_point()
var ray_normal = raycast.get_collision_normal()
if Input.is_action_just_pressed("pick_block"):
if Input.is_action_just_pressed(&"pick_block"):
# Block picking.
var block_global_position = Vector3i((ray_position - ray_normal / 2).floor())
_selected_block = voxel_world.get_block_global_position(block_global_position)
else:
# Block prev/next keys.
if Input.is_action_just_pressed("prev_block"):
if Input.is_action_just_pressed(&"prev_block"):
_selected_block -= 1
if Input.is_action_just_pressed("next_block"):
if Input.is_action_just_pressed(&"next_block"):
_selected_block += 1
_selected_block = wrapi(_selected_block, 1, 30)
# Set the appropriate texture.
@@ -43,8 +43,8 @@ func _process(_delta):
# Block breaking/placing.
if crosshair.visible and raycast.is_colliding():
var breaking = Input.is_action_just_pressed("break")
var placing = Input.is_action_just_pressed("place")
var breaking = Input.is_action_just_pressed(&"break")
var placing = Input.is_action_just_pressed(&"place")
# Either both buttons were pressed or neither are, so stop.
if breaking == placing:
return
@@ -62,7 +62,7 @@ func _physics_process(delta):
camera_effects.dof_blur_far_distance = Settings.fog_distance * 1.5
camera_effects.dof_blur_far_transition = Settings.fog_distance / 8
# Crouching.
var crouching = Input.is_action_pressed("crouch")
var crouching = Input.is_action_pressed(&"crouch")
if crouching:
head.transform.origin = Vector3(0, 1.2, 0)
else:
@@ -82,7 +82,7 @@ func _physics_process(delta):
move_and_slide()
# Jumping, applied next frame.
if is_on_floor() and Input.is_action_pressed("jump"):
if is_on_floor() and Input.is_action_pressed(&"jump"):
velocity.y = 5

View File

@@ -51,7 +51,7 @@ func _add_placeholder_key(container):
var placeholder = Control.new()
placeholder.size_flags_horizontal = SIZE_EXPAND_FILL
placeholder.mouse_filter = Control.MOUSE_FILTER_IGNORE
placeholder.name = "Placeholder"
placeholder.name = &"Placeholder"
container.add_child(placeholder)

View File

@@ -113,17 +113,17 @@ func set_view_mode(view_mode_index):
# This can be changed or removed in actual games where you only need one view mode.
func _check_view_mode():
if not Engine.editor_hint:
if Input.is_action_just_pressed("forty_five_mode"):
if Input.is_action_just_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_just_pressed("isometric_mode"):
elif Input.is_action_just_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_just_pressed("top_down_mode"):
elif Input.is_action_just_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_just_pressed("front_side_mode"):
elif Input.is_action_just_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_just_pressed("oblique_y_mode"):
elif Input.is_action_just_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_just_pressed("oblique_z_mode"):
elif Input.is_action_just_pressed(&"oblique_z_mode"):
set_view_mode(5)

View File

@@ -24,16 +24,16 @@ func _ready():
func _process(delta):
if Input.is_action_pressed("exit"):
if Input.is_action_pressed(&"exit"):
get_tree().quit()
if Input.is_action_just_pressed("view_cube_demo"):
if Input.is_action_just_pressed(&"view_cube_demo"):
# warning-ignore:return_value_discarded
get_tree().change_scene("res://assets/demo_scene.tscn")
return
if _is_parent_ready:
if Input.is_action_just_pressed("reset_position"):
if Input.is_action_just_pressed(&"reset_position"):
transform = Transform3D.IDENTITY
else:
rotate_x(delta * (Input.get_axis(&"move_forward", &"move_back")))

View File

@@ -10,17 +10,17 @@ extends Sprite2D
func _process(_delta):
if not Engine.editor_hint:
if Input.is_action_pressed("forty_five_mode"):
if Input.is_action_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_pressed("isometric_mode"):
elif Input.is_action_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_pressed("top_down_mode"):
elif Input.is_action_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_pressed("front_side_mode"):
elif Input.is_action_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_pressed("oblique_y_mode"):
elif Input.is_action_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_pressed("oblique_z_mode"):
elif Input.is_action_pressed(&"oblique_z_mode"):
set_view_mode(5)

View File

@@ -7,17 +7,17 @@ var isometric_controls := true
@onready var _parent_node25d: Node25D = get_parent()
func _process(delta):
if Input.is_action_pressed("exit"):
if Input.is_action_pressed(&"exit"):
get_tree().quit()
if Input.is_action_just_pressed("view_cube_demo"):
if Input.is_action_just_pressed(&"view_cube_demo"):
#warning-ignore:return_value_discarded
get_tree().change_scene("res://assets/cube/cube.tscn")
return
if Input.is_action_just_pressed("toggle_isometric_controls"):
if Input.is_action_just_pressed(&"toggle_isometric_controls"):
isometric_controls = not isometric_controls
if Input.is_action_just_pressed("reset_position"):
if Input.is_action_just_pressed(&"reset_position"):
transform = Transform3D(Basis(), Vector3.UP * 10)
vertical_speed = 0
else:
@@ -35,11 +35,11 @@ func _horizontal_movement(delta):
localZ = Vector3(0.70710678118, 0, 0.70710678118)
# Gather player input and add directional movement to a Vector3 variable.
var movement_vec2 = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
var movement_vec2 = Input.get_vector(&"move_left", &"move_right", &"move_forward", &"move_back")
var move_dir = localX * movement_vec2.x + localZ * movement_vec2.y
move_dir = move_dir * delta * 600
if Input.is_action_pressed("movement_modifier"):
if Input.is_action_pressed(&"movement_modifier"):
move_dir /= 2
#warning-ignore:return_value_discarded
@@ -49,7 +49,7 @@ func _horizontal_movement(delta):
# Checks Jump and applies gravity and vertical speed via move_and_collide.
func _vertical_movement(delta):
var localY = Vector3.UP
if Input.is_action_just_pressed("jump"):
if Input.is_action_just_pressed(&"jump"):
vertical_speed = 1.25
vertical_speed -= delta * 5 # Gravity
var k = move_and_collide(localY * vertical_speed)

View File

@@ -30,7 +30,7 @@ func _process(delta):
if movement:
hframes = 6
texture = _run
if (Input.is_action_pressed("movement_modifier")):
if (Input.is_action_pressed(&"movement_modifier")):
delta /= 2
_progress = fmod((_progress + FRAMERATE * delta), 6)
frame = _direction * 6 + int(_progress)
@@ -72,17 +72,17 @@ func set_view_mode(view_mode_index):
# Change the 2D basis of the sprite to try and make it "fit" multiple view modes.
func _sprite_basis():
if not Engine.editor_hint:
if Input.is_action_pressed("forty_five_mode"):
if Input.is_action_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_pressed("isometric_mode"):
elif Input.is_action_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_pressed("top_down_mode"):
elif Input.is_action_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_pressed("front_side_mode"):
elif Input.is_action_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_pressed("oblique_y_mode"):
elif Input.is_action_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_pressed("oblique_z_mode"):
elif Input.is_action_pressed(&"oblique_z_mode"):
set_view_mode(5)
@@ -92,25 +92,25 @@ func _check_movement() -> bool:
var x := 0
var z := 0
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed(&"move_right"):
x += 1
if Input.is_action_pressed("move_left"):
if Input.is_action_pressed(&"move_left"):
x -= 1
if Input.is_action_pressed("move_forward"):
if Input.is_action_pressed(&"move_forward"):
z -= 1
if Input.is_action_pressed("move_back"):
if Input.is_action_pressed(&"move_back"):
z += 1
# Check for isometric controls and add more to movement accordingly.
# For efficiency, only check the X axis since this X axis value isn't used anywhere else.
if not _parent_math.isometric_controls and is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x):
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed(&"move_right"):
z += 1
if Input.is_action_pressed("move_left"):
if Input.is_action_pressed(&"move_left"):
z -= 1
if Input.is_action_pressed("move_forward"):
if Input.is_action_pressed(&"move_forward"):
x += 1
if Input.is_action_pressed("move_back"):
if Input.is_action_pressed(&"move_back"):
x -= 1
# Set the direction based on which inputs were pressed.

View File

@@ -10,17 +10,17 @@ extends Sprite2D
func _process(_delta):
if not Engine.editor_hint:
if Input.is_action_pressed("forty_five_mode"):
if Input.is_action_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_pressed("isometric_mode"):
elif Input.is_action_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_pressed("top_down_mode"):
elif Input.is_action_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_pressed("front_side_mode"):
elif Input.is_action_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_pressed("oblique_y_mode"):
elif Input.is_action_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_pressed("oblique_z_mode"):
elif Input.is_action_pressed(&"oblique_z_mode"):
set_view_mode(5)

View File

@@ -1,5 +1,5 @@
extends Control
func _process(_delta):
if Input.is_action_just_pressed("toggle_control_hints"):
if Input.is_action_just_pressed(&"toggle_control_hints"):
visible = not visible

View File

@@ -68,15 +68,15 @@ func _unhandled_input(event):
mousepos = event.position
if event is InputEventKey:
if Input.is_action_pressed("mouse_mode_visible"):
if Input.is_action_pressed(&"mouse_mode_visible"):
observer.state = observer.STATE_MENU
_on_Button_MouseModeVisible_pressed()
if Input.is_action_pressed("mouse_mode_hidden"):
if Input.is_action_pressed(&"mouse_mode_hidden"):
observer.state = observer.STATE_MENU
_on_Button_MouseModeHidden_pressed()
if Input.is_action_pressed("mouse_mode_captured"):
if Input.is_action_pressed(&"mouse_mode_captured"):
_on_Button_MouseModeCaptured_pressed()

View File

@@ -10,17 +10,17 @@ extends Sprite2D
func _process(_delta):
if not Engine.editor_hint:
if Input.is_action_pressed("forty_five_mode"):
if Input.is_action_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_pressed("isometric_mode"):
elif Input.is_action_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_pressed("top_down_mode"):
elif Input.is_action_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_pressed("front_side_mode"):
elif Input.is_action_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_pressed("oblique_y_mode"):
elif Input.is_action_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_pressed("oblique_z_mode"):
elif Input.is_action_pressed(&"oblique_z_mode"):
set_view_mode(5)

View File

@@ -10,17 +10,17 @@ extends Sprite2D
func _process(_delta):
if not Engine.editor_hint:
if Input.is_action_pressed("forty_five_mode"):
if Input.is_action_pressed(&"forty_five_mode"):
set_view_mode(0)
elif Input.is_action_pressed("isometric_mode"):
elif Input.is_action_pressed(&"isometric_mode"):
set_view_mode(1)
elif Input.is_action_pressed("top_down_mode"):
elif Input.is_action_pressed(&"top_down_mode"):
set_view_mode(2)
elif Input.is_action_pressed("front_side_mode"):
elif Input.is_action_pressed(&"front_side_mode"):
set_view_mode(3)
elif Input.is_action_pressed("oblique_y_mode"):
elif Input.is_action_pressed(&"oblique_y_mode"):
set_view_mode(4)
elif Input.is_action_pressed("oblique_z_mode"):
elif Input.is_action_pressed(&"oblique_z_mode"):
set_view_mode(5)

View File

@@ -1,5 +1,5 @@
extends Control
func _process(_delta):
if Input.is_action_just_pressed("toggle_control_hints"):
if Input.is_action_just_pressed(&"toggle_control_hints"):
visible = not visible

View File

@@ -1,6 +1,6 @@
using Godot;
public partial class Mob : RigidBody2D
public partial class Mob : RigidDynamicBody2D
{
public override void _Ready()
{

View File

@@ -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 )

View File

@@ -25,16 +25,16 @@ func _physics_process(_delta):
var motion = Vector2()
if is_network_master():
if Input.is_action_pressed("move_left"):
if Input.is_action_pressed(&"move_left"):
motion += Vector2(-1, 0)
if Input.is_action_pressed("move_right"):
if Input.is_action_pressed(&"move_right"):
motion += Vector2(1, 0)
if Input.is_action_pressed("move_up"):
if Input.is_action_pressed(&"move_up"):
motion += Vector2(0, -1)
if Input.is_action_pressed("move_down"):
if Input.is_action_pressed(&"move_down"):
motion += Vector2(0, 1)
var bombing = Input.is_action_pressed("set_bomb")
var bombing = Input.is_action_pressed(&"set_bomb")
if stunned:
bombing = false

View File

@@ -50,18 +50,18 @@ func _process(delta):
# Move left pad.
var left_pos = left_paddle.get_position()
if left_pos.y > 0 and Input.is_action_pressed("left_move_up"):
if left_pos.y > 0 and Input.is_action_pressed(&"left_move_up"):
left_pos.y += -PAD_SPEED * delta
if left_pos.y < screen_size.y and Input.is_action_pressed("left_move_down"):
if left_pos.y < screen_size.y and Input.is_action_pressed(&"left_move_down"):
left_pos.y += PAD_SPEED * delta
left_paddle.set_position(left_pos)
# Move right pad.
var right_pos = right_paddle.get_position()
if right_pos.y > 0 and Input.is_action_pressed("right_move_up"):
if right_pos.y > 0 and Input.is_action_pressed(&"right_move_up"):
right_pos.y += -PAD_SPEED * delta
if right_pos.y < screen_size.y and Input.is_action_pressed("right_move_down"):
if right_pos.y < screen_size.y and Input.is_action_pressed(&"right_move_down"):
right_pos.y += PAD_SPEED * delta
right_paddle.set_position(right_pos)