@ -81,7 +81,7 @@ public class Bounds {
				@@ -81,7 +81,7 @@ public class Bounds {
					 
			
		
	
		
			
				
					        Bounds  identityBounds  =  Bounds . borrow ( ) ;   
			
		
	
		
			
				
					        identityBounds . setBounds ( location ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        collisionState  =  collide ( targetBounds ,  identityBounds ,  0 . 0 f) ;   
			
		
	
		
			
				
					        collisionState  =  collide ( targetBounds ,  identityBounds ,  0 . 1 f) ;   
			
		
	
		
			
				
					        identityBounds . release ( ) ;   
			
		
	
		
			
				
					        return  collisionState ;   
			
		
	
		
			
				
					    }   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -267,6 +267,45 @@ public class Bounds {
				@@ -267,6 +267,45 @@ public class Bounds {
					 
			
		
	
		
			
				
					        return  collidePoint ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  static  Vector3fImmutable  PlayerCollisionPoint ( PlayerCharacter  player ,  Vector3fImmutable  start ,  Vector3fImmutable  end )  {   
			
		
	
		
			
				
					        Vector3fImmutable  collidePoint  =  null ;   
			
		
	
		
			
				
					        float  distance  =  player . getLoc ( ) . distance2D ( end ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        // Check for building collisions first
   
			
		
	
		
			
				
					        collidePoint  =  PlayerBuildingCollisionPoint ( player ,  start ,  end ) ;   
			
		
	
		
			
				
					        if  ( collidePoint  ! =  null )  {   
			
		
	
		
			
				
					            return  collidePoint ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        // Now check for player collisions
   
			
		
	
		
			
				
					        HashSet < AbstractWorldObject >  nearbyPlayers  =  WorldGrid . getObjectsInRangePartial ( player ,  distance  +  2 ,  MBServerStatics . MASK_PLAYER ) ;   
			
		
	
		
			
				
					        float  minDistance  =  5 . 0f ;  // Minimum distance between players
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        for  ( AbstractWorldObject  awo  :  nearbyPlayers )  {   
			
		
	
		
			
				
					            PlayerCharacter  otherPlayer  =  ( PlayerCharacter )  awo ;   
			
		
	
		
			
				
					            if  ( otherPlayer  = =  player )  continue ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            Vector3fImmutable  otherLoc  =  otherPlayer . getLoc ( ) ;   
			
		
	
		
			
				
					            Vector3fImmutable  closestPoint  =  getClosestPointOnLine ( start ,  end ,  otherLoc ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( closestPoint . distance2D ( otherLoc )  <  minDistance )  {   
			
		
	
		
			
				
					                // Collision detected, adjust end point
   
			
		
	
		
			
				
					                Vector3fImmutable  pushVector  =  closestPoint . subtract ( otherLoc ) . normalize ( ) ;   
			
		
	
		
			
				
					                collidePoint  =  closestPoint . add ( pushVector . scaleAdd ( minDistance ,  Vector3fImmutable . ZERO ) ) ;   
			
		
	
		
			
				
					                break ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        return  collidePoint  ! =  null  ?  collidePoint  :  end ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    private  static  Vector3fImmutable  getClosestPointOnLine ( Vector3fImmutable  lineStart ,  Vector3fImmutable  lineEnd ,  Vector3fImmutable  point )  {   
			
		
	
		
			
				
					        Vector3fImmutable  line  =  lineEnd . subtract ( lineStart ) ;   
			
		
	
		
			
				
					        float  t  =  point . subtract ( lineStart ) . dot ( line )  /  line . dot ( line ) ;   
			
		
	
		
			
				
					        t  =  Math . max ( 0 ,  Math . min ( 1 ,  t ) ) ;   
			
		
	
		
			
				
					        return  lineStart . add ( line . scaleAdd ( t ,  Vector3fImmutable . ZERO ) ) ;   
			
		
	
		
			
				
					    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    public  static  boolean  linesTouching ( float  x1 ,  float  y1 ,  float  x2 ,  float  y2 ,  float  x3 ,  float  y3 ,  float  x4 ,  float  y4 )  {   
			
		
	
		
			
				
					        float  denominator  =  ( ( x2  -  x1 )  *  ( y4  -  y3 ) )  -  ( ( y2  -  y1 )  *  ( x4  -  x3 ) ) ;   
			
		
	
		
			
				
					        float  numerator1  =  ( ( y1  -  y3 )  *  ( x4  -  x3 ) )  -  ( ( x1  -  x3 )  *  ( y4  -  y3 ) ) ;