User Tools

Site Tools


tutorial:pixel_raycast

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:pixel_raycast [2020/08/14 17:12] emmanuelmesstutorial:pixel_raycast [2020/08/15 13:17] – [Performance considerations] emmanuelmess
Line 5: Line 5:
 All of this is client side. All of this is client side.
  
-There are two types, center pixel (crosshair) and arbitrary pixel.+There are two cases, center pixel (crosshair) and arbitrary pixel.
  
 ===== Special case: Center pixel  ===== ===== Special case: Center pixel  =====
Line 37: Line 37:
  
 ===== General case: Arbitrary pixel  ===== ===== General case: Arbitrary pixel  =====
 +
 +Example [[https://github.com/EmmanuelMess/BoundingBoxMinecraftMod|here]].
  
 For this one we need to precalculate a few things: For this one we need to precalculate a few things:
Line 88: Line 90:
     double extendedReach = reachDistance;     double extendedReach = reachDistance;
     if (client.interactionManager.hasExtendedReach()) {     if (client.interactionManager.hasExtendedReach()) {
-        extendedReach = 6.0D;+        extendedReach = 6.0D;//Change this to extend the reach
         reachDistance = extendedReach;         reachDistance = extendedReach;
     } else {     } else {
Line 189: Line 191:
 ==== Performance considerations ==== ==== Performance considerations ====
  
-This is EXPENSIVE, if you do it too many times, it WILL get slow. Especially for long reaches.+This is EXPENSIVE, if you do it too many times, it WILL get slow. Especially for long reaches. If you *need* to do many raycasts in a single frame, [[https://stackoverflow.com/q/777997/3124150|this]] link might be helpful.
tutorial/pixel_raycast.txt · Last modified: 2023/11/30 22:33 by famrofexl