mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-25 15:18:24 +07:00
Better physics
This commit is contained in:
@ -504,11 +504,11 @@ public class DesktopInput extends InputHandler{
|
||||
Vec2 movement = Tmp.v1.set(speed * xa, speed * ya).limit(speed);
|
||||
|
||||
if(omni){
|
||||
unit.vel().add(movement);
|
||||
unit.moveAt(movement);
|
||||
unit.lookAt(Angles.mouseAngle(unit.x(), unit.y()));
|
||||
}else{
|
||||
if(!unit.vel().isZero(0.01f)) unit.rotation(unit.vel().angle());
|
||||
unit.vel().add(Tmp.v2.trns(unit.rotation(), movement.len()));
|
||||
unit.moveAt(Tmp.v2.trns(unit.rotation(), movement.len()));
|
||||
if(!movement.isZero()) unit.vel().rotateTo(movement.angle(), unit.type().rotateSpeed * Time.delta());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user