Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
9dfe3b6d
Commit
9dfe3b6d
authored
Feb 23, 2019
by
Juan Linietsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure move and slide snap respects stop on slope, fixes #26180
parent
24097811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
physics_body_2d.cpp
scene/2d/physics_body_2d.cpp
+6
-0
physics_body.cpp
scene/3d/physics_body.cpp
+5
-0
No files found.
scene/2d/physics_body_2d.cpp
View file @
9dfe3b6d
...
...
@@ -1341,6 +1341,12 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci
on_floor
=
true
;
on_floor_body
=
col
.
collider_rid
;
floor_velocity
=
col
.
collider_vel
;
if
(
p_stop_on_slope
)
{
// 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.
col
.
travel
=
p_floor_direction
*
p_floor_direction
.
dot
(
col
.
travel
);
}
}
else
{
apply
=
false
;
}
...
...
scene/3d/physics_body.cpp
View file @
9dfe3b6d
...
...
@@ -1288,6 +1288,11 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity
on_floor
=
true
;
on_floor_body
=
col
.
collider_rid
;
floor_velocity
=
col
.
collider_vel
;
if
(
p_stop_on_slope
)
{
// 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.
col
.
travel
=
p_floor_direction
*
p_floor_direction
.
dot
(
col
.
travel
);
}
}
else
{
apply
=
false
;
//snapped with floor direction, but did not snap to a floor, do not snap.
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment