Warning: I'm still trying to get my bearings in the engine, and I'm a code novice in general. Most of this stuff will be horrifically inefficient.
Simple system for replacing physics entities that have stopped moving.
Simple system for replacing physics entities that have stopped moving.
Code:
PhysicsBlockHardeningSystem
/*Add to physics entities that are supposed to settle*/
/*Unknown Variable Type*/ previousBlockLocation;
int hardenTimeout;
int hardenTimeoutCap; //For configuring how quickly blocks harden
/*loop this every X seconds*/
for (physics block : active physics blocks){
if (CurrentLocation != previousBlockLocation)
previousBlockLocation = CurrentLocation
else
hardenTimeout ++;
if (hardenTimeout >= hardenTimeoutCap)
/*spawn a matching non-physics block*/
/*delete this entity*/
Last edited: