mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
Velocity limit, to prevent NaNs
This commit is contained in:
@@ -130,6 +130,7 @@
|
|||||||
#define CELL 4
|
#define CELL 4
|
||||||
#define ISTP (CELL/2)
|
#define ISTP (CELL/2)
|
||||||
#define CFDS (4.0f/CELL)
|
#define CFDS (4.0f/CELL)
|
||||||
|
#define SIM_MAXVELOCITY 1e4f
|
||||||
|
|
||||||
//Air constants
|
//Air constants
|
||||||
#define AIR_TSTEPP 0.3f
|
#define AIR_TSTEPP 0.3f
|
||||||
|
@@ -4199,6 +4199,12 @@ killed:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (mv > SIM_MAXVELOCITY)
|
||||||
|
{
|
||||||
|
parts[i].vx *= SIM_MAXVELOCITY/mv;
|
||||||
|
parts[i].vy *= SIM_MAXVELOCITY/mv;
|
||||||
|
mv = SIM_MAXVELOCITY;
|
||||||
|
}
|
||||||
// interpolate to see if there is anything in the way
|
// interpolate to see if there is anything in the way
|
||||||
dx = parts[i].vx*ISTP/mv;
|
dx = parts[i].vx*ISTP/mv;
|
||||||
dy = parts[i].vy*ISTP/mv;
|
dy = parts[i].vy*ISTP/mv;
|
||||||
|
Reference in New Issue
Block a user