public void ForceMoveInto(CollisionMoveHit hit, float moveAmount) { ICollidable collidable = CollidableHelpers.GetCollidable(hit.transform); float collideDistance = hit.GetCollideDistance(moveAmount); collidable.OnPhysicsMoveInto(transform, collideDistance, hit.rayDirection, hit.point); }
public float GetAllowedMoveInto(CollisionMoveHit hit, float wantToMove) { if (!hit.isTilemap && wantToMove <= hit.distanceToHit) { return(wantToMove); } ICollidable collidable = CollidableHelpers.GetCollidable(hit.transform); float collideDistance = hit.GetCollideDistance(wantToMove); float allowedCollideDistance = collidable.GetAllowedMoveInto(transform, collideDistance, hit.rayDirection, hit.point); float allowedDistance = allowedCollideDistance + hit.distanceToHit; return(Mathf.Clamp(allowedDistance, 0, wantToMove)); }
public virtual bool Match(CollisionMoveHit hit) => true;