Stash failed collision preventer
This commit is contained in:
@@ -37,7 +37,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
public static final float maxAbsVelocity = 127f / velocityPercision;
|
public static final float maxAbsVelocity = 127f / velocityPercision;
|
||||||
public static final int noSpawner = Pos.get(-1, 1);
|
public static final int noSpawner = Pos.get(-1, 1);
|
||||||
|
|
||||||
private static final Vec2 moveVector = new Vec2();
|
protected static final Vec2 moveVector = new Vec2();
|
||||||
|
|
||||||
public float rotation;
|
public float rotation;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package mindustry.entities.type.base;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.entities.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
@@ -32,10 +34,39 @@ public class CraterUnit extends GroundUnit{
|
|||||||
},
|
},
|
||||||
move = new UnitState(){
|
move = new UnitState(){
|
||||||
public void update(){
|
public void update(){
|
||||||
// move in the direction/rotation of the block its currently on
|
// float radScl = 1.5f;
|
||||||
velocity.add(vec.trnsExact(angleTo(on().front()), type.speed * Time.delta()));
|
// float fsize = getSize() / radScl / 100;
|
||||||
rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed);
|
// float cx = x - fsize/2f, cy = y - fsize/2f;
|
||||||
|
|
||||||
|
// Log.info(unitGroup.intersect(x, y, 3, 3).size);
|
||||||
|
|
||||||
|
// int size = unitGroup.intersect(cx, cy, fsize, fsize).select(unit -> {
|
||||||
|
// Log.info(lastPosition());
|
||||||
|
// Log.info(lastPosition().trns(45, tilesize));
|
||||||
|
|
||||||
|
// Vec2 front = lastPosition().cpy().add(lastPosition().trns(rotation, 6));
|
||||||
|
|
||||||
|
// return front.dst(unit) < 2;
|
||||||
|
|
||||||
|
// velocity.scl()
|
||||||
|
|
||||||
|
// }).size;
|
||||||
|
// Log.info(player.lastPosition());
|
||||||
|
// Log.info(lastPosition());
|
||||||
|
// Log.info(size);
|
||||||
|
//
|
||||||
|
// if(size < 1){
|
||||||
|
|
||||||
|
// if(moveVector.isZero()){
|
||||||
|
// move in the direction/rotation of the block its currently on
|
||||||
|
velocity.add(vec.trnsExact(angleTo(on().front()), type.speed * Time.delta()));
|
||||||
|
rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// velocity.
|
||||||
|
|
||||||
|
Log.info(moveVector);
|
||||||
// switch to unload when on an end tile
|
// switch to unload when on an end tile
|
||||||
if(dst(on()) < 2.5f && on(Track.end)){
|
if(dst(on()) < 2.5f && on(Track.end)){
|
||||||
state.set(unload);
|
state.set(unload);
|
||||||
|
|||||||
Reference in New Issue
Block a user