If player is through a wall

Discussion in 'Plugin Development' started by nathanthesnooper, Feb 21, 2018.

Thread Status:
Not open for further replies.
  1. Using a BlockIteratorr, I am able to roughly see if a player is through a wall from the perspective of another player

    But what about players on the edge of walls?
    Also, is there a util to check if a hitbox is through a wall?

    Code:
             +---------------------+
             |                     |
             |                     |   +--------------+
             |                     |   |              |
             |                     |   |              |
             |                     |   |              |
             |        Wall         |   |    Player    |
             |                     |   |              |
             |                     |   |              |
             |                     |   |              |
             |                     |   +--------------+
             |                     |
             +---------------------+
    
    
    
    +------------------+
    |                  |
    |                  |
    |                  |
    |                  |
    |     Player       |
    |                  |
    |                  |
    |                  |
    |                  |
    +------------------+
    
     
  2. Offline

    DutchJellyV2

    I think the hitbox size is 1/2 * 1/2 blocks squared. Get the position, use pythagoras to calculate diagonals length to calculate the corners positions. After that you can create a lines between the players view position and the 8 corners. Finally check with a forloop if the line between the viewposition and the corners crosses any block by rounding the value down to whole numbers (integers). It'd be ofcourse better to create more lines to other points of the hitbox, but I figured the corners would be really important given your example.
    This is pure mathamatics!
     
Thread Status:
Not open for further replies.

Share This Page