tutorial:pixel_raycast
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:pixel_raycast [2020/08/14 17:12] – emmanuelmess | tutorial: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:// | ||
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:// |
tutorial/pixel_raycast.txt · Last modified: 2023/11/30 22:33 by famrofexl