mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Fix collision code getting stuck if speed is 0
This commit is contained in:
@@ -29,6 +29,10 @@ collisionMoveResult collisionMoveSimple(Map *map, IGameDef *gamedef,
|
|||||||
{
|
{
|
||||||
collisionMoveResult result;
|
collisionMoveResult result;
|
||||||
|
|
||||||
|
// If there is no speed, there are no collisions
|
||||||
|
if(speed_f.getLength() == 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
v3f oldpos_f = pos_f;
|
v3f oldpos_f = pos_f;
|
||||||
v3s16 oldpos_i = floatToInt(oldpos_f, BS);
|
v3s16 oldpos_i = floatToInt(oldpos_f, BS);
|
||||||
|
|
||||||
@@ -197,6 +201,10 @@ collisionMoveResult collisionMovePrecise(Map *map, IGameDef *gamedef,
|
|||||||
{
|
{
|
||||||
collisionMoveResult final_result;
|
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)
|
// Maximum time increment (for collision detection etc)
|
||||||
// time = distance / speed
|
// time = distance / speed
|
||||||
f32 dtime_max_increment = pos_max_d / speed_f.getLength();
|
f32 dtime_max_increment = pos_max_d / speed_f.getLength();
|
||||||
|
Reference in New Issue
Block a user