diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-03-31 10:25:09 -0500 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-04-03 10:02:12 -0500 |
commit | 1a620bd5faebd83015182ea032f40936a9916af6 (patch) | |
tree | e1705e3805bae8cb898694136f65d7622dd2bc8c /scene | |
parent | 6731924dcfa7451d8b31461b438fd2a5aa8af1f6 (diff) |
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 'scene')
-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 88845a7290..f820c955a7 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); |