|
@@ -70,12 +70,12 @@ Ref<KinematicCollision2D> PhysicsBody2D::_move(const Vector2 &p_motion, bool p_t
|
|
|
return Ref<KinematicCollision2D>();
|
|
|
}
|
|
|
|
|
|
-bool PhysicsBody2D::move_and_collide(const Vector2 &p_motion, PhysicsServer2D::MotionResult &r_result, real_t p_margin, bool p_test_only, bool p_cancel_sliding, const Set<RID> &p_exclude) {
|
|
|
+bool PhysicsBody2D::move_and_collide(const Vector2 &p_motion, PhysicsServer2D::MotionResult &r_result, real_t p_margin, bool p_test_only, bool p_cancel_sliding, bool p_collide_separation_ray, const Set<RID> &p_exclude) {
|
|
|
if (is_only_update_transform_changes_enabled()) {
|
|
|
ERR_PRINT("Move functions do not work together with 'sync to physics' option. Please read the documentation.");
|
|
|
}
|
|
|
Transform2D gt = get_global_transform();
|
|
|
- bool colliding = PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_margin, &r_result, p_exclude);
|
|
|
+ bool colliding = PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_margin, &r_result, p_collide_separation_ray, p_exclude);
|
|
|
|
|
|
// Restore direction of motion to be along original motion,
|
|
|
// in order to avoid sliding due to recovery,
|
|
@@ -1075,7 +1075,7 @@ bool CharacterBody2D::move_and_slide() {
|
|
|
PhysicsServer2D::MotionResult floor_result;
|
|
|
Set<RID> exclude;
|
|
|
exclude.insert(platform_rid);
|
|
|
- if (move_and_collide(current_platform_velocity * delta, floor_result, margin, false, false, exclude)) {
|
|
|
+ if (move_and_collide(current_platform_velocity * delta, floor_result, margin, false, false, false, exclude)) {
|
|
|
motion_results.push_back(floor_result);
|
|
|
_set_collision_direction(floor_result);
|
|
|
}
|
|
@@ -1285,7 +1285,7 @@ void CharacterBody2D::_snap_on_floor(bool was_on_floor, bool vel_dir_facing_up)
|
|
|
|
|
|
Transform2D gt = get_global_transform();
|
|
|
PhysicsServer2D::MotionResult result;
|
|
|
- if (move_and_collide(up_direction * -floor_snap_length, result, margin, true, false)) {
|
|
|
+ if (move_and_collide(up_direction * -floor_snap_length, result, margin, true, false, true)) {
|
|
|
bool apply = true;
|
|
|
if (result.get_angle(up_direction) <= floor_max_angle + FLOOR_ANGLE_THRESHOLD) {
|
|
|
on_floor = true;
|
|
@@ -1319,7 +1319,7 @@ bool CharacterBody2D::_on_floor_if_snapped(bool was_on_floor, bool vel_dir_facin
|
|
|
}
|
|
|
|
|
|
PhysicsServer2D::MotionResult result;
|
|
|
- if (move_and_collide(up_direction * -floor_snap_length, result, margin, true, false)) {
|
|
|
+ if (move_and_collide(up_direction * -floor_snap_length, result, margin, true, false, true)) {
|
|
|
if (result.get_angle(up_direction) <= floor_max_angle + FLOOR_ANGLE_THRESHOLD) {
|
|
|
return true;
|
|
|
}
|