diff options
| author | Ferenc Arn | 2017-03-31 10:25:09 -0500 |
|---|---|---|
| committer | Ferenc Arn | 2017-04-03 10:02:12 -0500 |
| commit | 1a620bd5faebd83015182ea032f40936a9916af6 (patch) | |
| tree | e1705e3805bae8cb898694136f65d7622dd2bc8c /scene/2d/physics_body_2d.cpp | |
| parent | 6731924dcfa7451d8b31461b438fd2a5aa8af1f6 (diff) | |
| download | godot-1a620bd5faebd83015182ea032f40936a9916af6.tar.gz godot-1a620bd5faebd83015182ea032f40936a9916af6.tar.zst godot-1a620bd5faebd83015182ea032f40936a9916af6.zip | |
Made slide and reflect active verbs acting on itself in Vector2 and Vector3.
This is in alignment with other functions in vector classes.
Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs.
Fixes #8201.
Diffstat (limited to '')
| -rw-r--r-- | scene/2d/physics_body_2d.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 88845a729..f820c955a 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1205,8 +1205,9 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const } } - motion = get_collision_normal().slide(motion); - lv = get_collision_normal().slide(lv); + Vector2 n = get_collision_normal(); + motion = motion.slide(n); + lv = lv.slide(n); Variant collider = _get_collider(); if (collider.get_type() != Variant::NIL) { move_and_slide_colliders.push_back(collider); |
