Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Double Raycast

The raycast implementation by Callan and Sandy, updated for decimal variables with Jesse's trigonometric approximations.

Trigger the Spawn Raycast function from an item or another Housing action. When the closest player is hit, the project calls Raycast:Target for that player and Raycast:Sender for the caster.

The callback functions receive these global variables:

  • ray/length: distance to the hit in blocks
  • ray/headshot: 1 for a headshot and 0 for a body shot

Edit src/target.htsl and src/sender.htsl to replace the example messages with your own weapon or ability behavior. You can reject hits beyond a maximum range by checking ray/length in those callbacks.

The hit radius is configured with ray/dist2 near the top of src/spawn_raycast.htsl. It is the squared radius, so 1.0 means a 1-block radius and 4.0 means a 2-block radius.

Headshots use a separate ray-distance test centered at Y + 1.7, so they work at any elevation angle. ray/headDist2 configures the squared head radius; the default 0.2 is approximately a 0.45-block radius.

The maximum range is configured with ray/maxDist2. Its default 225.0 is 15², limiting body and head hits to 15 blocks without requiring a square root.

The player test uses |offset|²|look|² - (offset · look)², an algebraically equivalent form of the squared cross-product magnitude. look/len2 is computed once per cast so the hit radius and headshot projection remain accurate even when the trigonometric approximation is not perfectly unit length.

Validate the project with:

htsw check

2D visualization: https://www.desmos.com/geometry/altalbbynt

About

An efficient player raycast for Hypixel Housing, built with HTSW.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors