diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/decal.cpp | 3 | ||||
-rw-r--r-- | scene/3d/gpu_particles_collision_3d.cpp | 6 | ||||
-rw-r--r-- | scene/3d/occluder_instance_3d.cpp | 3 | ||||
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 17 | ||||
-rw-r--r-- | scene/3d/reflection_probe.cpp | 4 |
5 files changed, 17 insertions, 16 deletions
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/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp index 6ac9364b1a..2235de1599 100644 --- a/scene/3d/gpu_particles_collision_3d.cpp +++ b/scene/3d/gpu_particles_collision_3d.cpp @@ -256,10 +256,10 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons Vector2 pq1 = v1 - e1 * CLAMP(v1.dot(e1) / e1.dot(e1), 0.0, 1.0); Vector2 pq2 = v2 - e2 * CLAMP(v2.dot(e2) / e2.dot(e2), 0.0, 1.0); - float s = SGN(e0.x * e2.y - e0.y * e2.x); + float s = SIGN(e0.x * e2.y - e0.y * e2.x); Vector2 d2 = Vector2(pq0.dot(pq0), s * (v0.x * e0.y - v0.y * e0.x)).min(Vector2(pq1.dot(pq1), s * (v1.x * e1.y - v1.y * e1.x))).min(Vector2(pq2.dot(pq2), s * (v2.x * e2.y - v2.y * e2.x))); - inside_d = -Math::sqrt(d2.x) * SGN(d2.y); + inside_d = -Math::sqrt(d2.x) * SIGN(d2.y); } //make sure distance to planes is not shorter if inside @@ -288,7 +288,7 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons Vector3 nor = ba.cross(ac); inside_d = Math::sqrt( - (SGN(ba.cross(nor).dot(pa)) + SGN(cb.cross(nor).dot(pb)) + SGN(ac.cross(nor).dot(pc)) < 2.0) + (SIGN(ba.cross(nor).dot(pa)) + SIGN(cb.cross(nor).dot(pb)) + SIGN(ac.cross(nor).dot(pc)) < 2.0) ? MIN(MIN( Vector3_dot2(ba * CLAMP(ba.dot(pa) / Vector3_dot2(ba), 0.0, 1.0) - pa), Vector3_dot2(cb * CLAMP(cb.dot(pb) / Vector3_dot2(cb), 0.0, 1.0) - pb)), 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..edaf76bc3e 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 { @@ -1584,6 +1587,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 +1634,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/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 40d4d822c9..f7f19596a7 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -94,7 +94,7 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) { } if (extents[i] - 0.01 < ABS(origin_offset[i])) { - origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01); + origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01); } } @@ -113,7 +113,7 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) { for (int i = 0; i < 3; i++) { if (extents[i] - 0.01 < ABS(origin_offset[i])) { - origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01); + origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01); } } RS::get_singleton()->reflection_probe_set_extents(probe, extents); |