tutorial:pixel_raycast
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:pixel_raycast [2023/02/22 08:23] – Minor formatting fix redgrapefruit | tutorial:pixel_raycast [2023/11/30 22:33] (current) – [For arbitrary reach] Naming fix famrofexl | ||
|---|---|---|---|
| Line 34: | Line 34: | ||
| ==== For arbitrary reach ==== | ==== For arbitrary reach ==== | ||
| - | The code above allows for the normal reach, 3 blocks for survival and 4.5 in creative. If you want the raycast to reach farther you need to use the general case below. | + | The code above allows for the normal reach, 3 blocks for survival and 4.5 in creative. If you want the raycast to reach farther you need to replace <code java> HitResult hit = client.crosshairTarget;</ |
| + | |||
| + | <code java [enable_line_numbers=" | ||
| + | double maxReach = 1000; //The farthest target the cameraEntity can detect | ||
| + | float tickDelta = 1.0F; //Used for tracking animation progress; no tracking is 1.0F | ||
| + | boolean includeFluids = true; //Whether to detect fluids as blocks | ||
| + | |||
| + | HitResult hit = client.cameraEntity.raycast(maxReach, | ||
| + | </ | ||
| ===== General case: Arbitrary pixel ===== | ===== General case: Arbitrary pixel ===== | ||
tutorial/pixel_raycast.1677054224.txt.gz · Last modified: 2023/02/22 08:23 by redgrapefruit