projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7281c68
)
Fix collision code getting stuck if speed is 0
author
Perttu Ahola
<celeron55@gmail.com>
Sat, 7 Apr 2012 16:19:36 +0000
(19:19 +0300)
committer
Perttu Ahola
<celeron55@gmail.com>
Sat, 7 Apr 2012 16:19:36 +0000
(19:19 +0300)
src/collision.cpp
patch
|
blob
|
history
diff --git
a/src/collision.cpp
b/src/collision.cpp
index 3460b04fdb719f75072c444ae243f61a5957de0a..ff0c083fd0bfa6efed23833b54c241da9c3f6297 100644
(file)
--- a/
src/collision.cpp
+++ b/
src/collision.cpp
@@
-29,6
+29,10
@@
collisionMoveResult collisionMoveSimple(Map *map, IGameDef *gamedef,
{
collisionMoveResult result;
+ // If there is no speed, there are no collisions
+ if(speed_f.getLength() == 0)
+ return result;
+
v3f oldpos_f = pos_f;
v3s16 oldpos_i = floatToInt(oldpos_f, BS);
@@
-196,6
+200,10
@@
collisionMoveResult collisionMovePrecise(Map *map, IGameDef *gamedef,
f32 dtime, v3f &pos_f, v3f &speed_f)
{
collisionMoveResult final_result;
+
+ // If there is no speed, there are no collisions
+ if(speed_f.getLength() == 0)
+ return final_result;
// Maximum time increment (for collision detection etc)
// time = distance / speed