Holy sh*t this looks smooth

This commit is contained in:
Patrick 'Quezler' Mounier
2020-01-01 11:47:36 +01:00
parent 07d23b4489
commit fd5f914845

View File

@@ -46,7 +46,8 @@ public class CraterUnit extends GroundUnit{
if(dst(target) > 1f){ // move to target...
velocity.add(vec.trnsExact(angleTo(target), type.speed * Time.delta()));
}else{ // ...but snap on its center
set(target.drawx(), target.drawy()); // fixme: make movement more majestically
x = Mathf.lerp(x, target.drawx(), 0.01f);
y = Mathf.lerp(y, target.drawy(), 0.01f);
}
rotation = Mathf.slerpDelta(rotation, angleTo(on().front()), type.rotatespeed);