Преглед изворни кода

Change p_stop_on_slope in 3D move_and_slide_with_snap

Demiu пре 6 година
родитељ
комит
fead4e369a
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      scene/3d/physics_body.cpp

+ 1 - 1
scene/3d/physics_body.cpp

@@ -1282,7 +1282,7 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity
 				if (p_stop_on_slope) {
 				if (p_stop_on_slope) {
 					// move and collide may stray the object a bit because of pre un-stucking,
 					// move and collide may stray the object a bit because of pre un-stucking,
 					// so only ensure that motion happens on floor direction in this case.
 					// so only ensure that motion happens on floor direction in this case.
-					col.travel = p_floor_direction * p_floor_direction.dot(col.travel);
+					col.travel = col.travel.project(p_floor_direction);
 				}
 				}
 			} else {
 			} else {
 				apply = false; //snapped with floor direction, but did not snap to a floor, do not snap.
 				apply = false; //snapped with floor direction, but did not snap to a floor, do not snap.