#Raycast

1 messages · Page 1 of 1 (latest)

dreamy laurel
#

You would need to set end to a point 100 blocks out from the player's line of sight. In other words: ×100 the player's view direction.

const ray = source.getBlockFromViewDirection({maxDistance: 100});
const start = add(source.location, {x: 0, y: 1.5, z: 0});
let end;
if(ray != undefined) end = ray.block.location;
else end = add(start, multiply(source.getViewDirection(), 100));
// steps, for ... etc.
#

@faint walrus