1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Reach distance(attack) edit

Discussion in 'Development' started by minijaham, Oct 28, 2020.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hello! I came here to ask if it is possible to edit the reach distance of a player when attacking.

    For example, when a player attacks, their reach is longer than the default Minecraft reach distance.
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    You could repeatedly shoot a raycast, measure the distance and perform attack.

    If I recall correctly, then the left mouse button spammed Interaction packets, so you should handle that case if I'm right.

    Internal Handling: https://github.com/pmmp/PocketMine-...8bcd0642ef3fc/src/pocketmine/Player.php#L2648
    RayTrace: https://github.com/pmmp/Math/blob/stable/src/VoxelRayTrace.php

    ^ returns Vector3[] of voxels it passed through tho.

    Might be helpful as well: https://github.com/pmmp/PocketMine-...ne/entity/projectile/Projectile.php#L189-L199

    I think you'll figure it out. cheers!
     
    Last edited: Oct 28, 2020
    ethaniccc and minijaham like this.
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hello Primus! Thank you for your response. This definitely helped.
     
    Primus likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.