stom66

Tabletop Simulator Cast on Ping

Mar 23rd, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. function onPlayerPing(player, position, object)
  2.    
  3.     local objects = Physics.cast({
  4.         origin    = position:add(vector(0, 100, 0)),
  5.         direction = vector(0, -10, 0),
  6.         type      = 1, -- ray
  7.         debug     = true
  8.     })
  9.    
  10.     if #objects > 0 and objects[1].hit_object.guid then
  11.         local msg = "Raycast found ".. objects[1].hit_object.getName()
  12.         broadcastToColor(msg, player.color)
  13.     else
  14.         broadcastToColor("Found nothing", player.color)
  15.     end
  16. end
  17.  
Advertisement
Add Comment
Please, Sign In to add comment