#raycasting issues.

1 messages · Page 1 of 1 (latest)

red solar
#
  set {_ray} to ray trace from {_p} with max distance 6 with size 0.05
  return block at raytrace result of {_ray}

command /raycast:
  trigger:
    set {_hit_block} to getBlock(player)
    if {_hit_block} is not air:
      message "&aYou hit a &b%{_hit_block}%&a!"
    else:
      message "&7The raycast didn't hit any block within 6 blocks."```

returns

```[]:     Can't understand this expression: 'ray trace from {_p} with max distance 6 with size 0.05'
[]:     Line: set {_ray} to ray trace from {_p} with max distance 6 with size 0.05
[]:  
[]: Line 3: (test.sk)
[]:     function getBlock (simple event) is declared to return a block, but 'block at raytrace result of {_ray}' is not of that type.
[]:     Line: return block at raytrace result of {_ray}```

i have skbee and skript.
fathom walrus
#

return hit block of {_ray}

#

and I'm not sure what's up with the first error, I don't use the raytrace options that much

#

it seems to be with ray size %number% and not with size %number% @red solar

red solar
#

alr ima test this in a minute

red solar
#
  set {_ray} to ray trace from {_p} with max distance 6 with ray size 0.05
  return hit block of {_ray}

command /raycast:
  trigger:
    set {_hit_block} to getBlock(player)
    if {_hit_block} is not air:
      message "&aYou hit a &b%{_hit_block}%&a!"
    else:
      message "&7The raycast didn't hit any block within 6 blocks."``` doesnt error but also doesnt work. I realized that i never specify where the raycast is supposed to be fired but i have no clue how and the only example i found was with skirt and skirt is kinda outdated
fathom walrus
#

it shoots towards where the player is looking

#

try debugging