summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/3d/collision_object_3d.cpp2
-rw-r--r--scene/3d/decal.cpp3
-rw-r--r--scene/3d/node_3d.cpp2
-rw-r--r--scene/3d/occluder_instance_3d.cpp3
-rw-r--r--scene/3d/physics_body_3d.cpp28
-rw-r--r--scene/3d/skeleton_3d.cpp2
-rw-r--r--scene/3d/soft_dynamic_body_3d.cpp2
8 files changed, 26 insertions, 18 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 34f748b197..efe23c6102 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -311,7 +311,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
while (stream_playbacks.size() > max_polyphony) {
AudioServer::get_singleton()->stop_playback_stream(stream_playbacks[0]);
- stream_playbacks.remove(0);
+ stream_playbacks.remove_at(0);
}
}
}
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index a166a05c71..085f1ade66 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -628,7 +628,7 @@ void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape)
--debug_shapes_count;
}
- shapes[p_owner].shapes.remove(p_shape);
+ shapes[p_owner].shapes.remove_at(p_shape);
for (KeyValue<uint32_t, ShapeData> &E : shapes) {
for (int i = 0; i < E.value.shapes.size(); i++) {
diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp
index c9f634a5e5..500bf4d8f5 100644
--- a/scene/3d/decal.cpp
+++ b/scene/3d/decal.cpp
@@ -175,9 +175,6 @@ TypedArray<String> Decal::get_configuration_warnings() const {
}
if (cull_mask == 0) {
- // NOTE: This warning will not be emitted if none of the 20 checkboxes
- // exposed in the editor are checked. This is because there are
- // currently 12 unexposed layers in the editor inspector.
warnings.push_back(TTR("The decal's Cull Mask has no bits enabled, which means the decal will not paint objects on any layer.\nTo resolve this, enable at least one bit in the Cull Mask property."));
}
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index b7b88c7135..ddd9d2da8a 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -478,7 +478,7 @@ void Node3D::remove_gizmo(Ref<Node3DGizmo> p_gizmo) {
int idx = data.gizmos.find(p_gizmo);
if (idx != -1) {
p_gizmo->free();
- data.gizmos.remove(idx);
+ data.gizmos.remove_at(idx);
}
#endif
}
diff --git a/scene/3d/occluder_instance_3d.cpp b/scene/3d/occluder_instance_3d.cpp
index 6c548edc74..aeac430cd9 100644
--- a/scene/3d/occluder_instance_3d.cpp
+++ b/scene/3d/occluder_instance_3d.cpp
@@ -329,9 +329,6 @@ TypedArray<String> OccluderInstance3D::get_configuration_warnings() const {
}
if (bake_mask == 0) {
- // NOTE: This warning will not be emitted if none of the 20 checkboxes
- // exposed in the editor are checked. This is because there are
- // currently 12 unexposed layers in the editor inspector.
warnings.push_back(TTR("The Bake Mask has no bits enabled, which means baking will not produce any occluder meshes for this OccluderInstance3D.\nTo resolve this, enable at least one bit in the Bake Mask property."));
}
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 5cb7f431e3..393e29e398 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1299,7 +1299,6 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
// in order to avoid blocking lateral motion along a wall.
if (motion_angle < .5 * Math_PI) {
apply_default_sliding = false;
-
if (p_was_on_floor && !vel_dir_facing_up) {
// Cancel the motion.
Transform3D gt = get_global_transform();
@@ -1307,14 +1306,18 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
real_t cancel_dist_max = MIN(0.1, margin * 20);
if (travel_total <= margin + CMP_EPSILON) {
gt.origin -= result.travel;
+ result.travel = Vector3(); // Cancel for constant speed computation.
} else if (travel_total < cancel_dist_max) { // If the movement is large the body can be prevented from reaching the walls.
gt.origin -= result.travel.slide(up_direction);
// Keep remaining motion in sync with amount canceled.
motion = motion.slide(up_direction);
+ result.travel = Vector3();
+ } else {
+ // Travel is too high to be safely cancelled, we take it into account.
+ result.travel = result.travel.slide(up_direction);
+ motion = motion.normalized() * result.travel.length();
}
set_global_transform(gt);
- result.travel = Vector3(); // Cancel for constant speed computation.
-
// Determines if you are on the ground, and limits the possibility of climbing on the walls because of the approximations.
_snap_on_floor(true, false);
} else {
@@ -1325,8 +1328,15 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
// Apply slide on forward in order to allow only lateral motion on next step.
Vector3 forward = wall_normal.slide(up_direction).normalized();
motion = motion.slide(forward);
- // Avoid accelerating when you jump on the wall and smooth falling.
- motion_velocity = motion_velocity.slide(forward);
+
+ // Scales the horizontal velocity according to the wall slope.
+ if (vel_dir_facing_up) {
+ Vector3 slide_motion = motion_velocity.slide(result.collisions[0].normal);
+ // Keeps the vertical motion from motion_velocity and add the horizontal motion of the projection.
+ motion_velocity = up_direction * up_direction.dot(motion_velocity) + slide_motion.slide(up_direction);
+ } else {
+ motion_velocity = motion_velocity.slide(forward);
+ }
// Allow only lateral motion along previous floor when already on floor.
// Fixes slowing down when moving in diagonal against an inclined wall.
@@ -1584,6 +1594,7 @@ void CharacterBody3D::_set_collision_direction(const PhysicsServer3D::MotionResu
Vector3 prev_wall_normal = wall_normal;
int wall_collision_count = 0;
Vector3 combined_wall_normal;
+ Vector3 tmp_wall_col; // Avoid duplicate on average calculation.
for (int i = p_result.collision_count - 1; i >= 0; i--) {
const PhysicsServer3D::MotionCollision &collision = p_result.collisions[i];
@@ -1630,8 +1641,11 @@ void CharacterBody3D::_set_collision_direction(const PhysicsServer3D::MotionResu
}
// Collect normal for calculating average.
- combined_wall_normal += collision.normal;
- wall_collision_count++;
+ if (!collision.normal.is_equal_approx(tmp_wall_col)) {
+ tmp_wall_col = collision.normal;
+ combined_wall_normal += collision.normal;
+ wall_collision_count++;
+ }
}
if (r_state.wall) {
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index d4d3c0ebe1..04b5b88ef8 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -633,7 +633,7 @@ void Skeleton3D::remove_bone_child(int p_bone, int p_child) {
int child_idx = bones[p_bone].child_bones.find(p_child);
if (child_idx >= 0) {
- bones.write[p_bone].child_bones.remove(child_idx);
+ bones.write[p_bone].child_bones.remove_at(child_idx);
} else {
WARN_PRINT("Cannot remove child bone: Child bone not found.");
}
diff --git a/scene/3d/soft_dynamic_body_3d.cpp b/scene/3d/soft_dynamic_body_3d.cpp
index 903eedb58b..5546b88fb1 100644
--- a/scene/3d/soft_dynamic_body_3d.cpp
+++ b/scene/3d/soft_dynamic_body_3d.cpp
@@ -773,7 +773,7 @@ void SoftDynamicBody3D::_reset_points_offsets() {
void SoftDynamicBody3D::_remove_pinned_point(int p_point_index) {
const int id(_has_pinned_point(p_point_index));
if (-1 != id) {
- pinned_points.remove(id);
+ pinned_points.remove_at(id);
}
}