#does anyone know how to make a line of sight system by using raycasts?

1 messages · Page 1 of 1 (latest)

vocal flame
#
  1. https://discord.com/channels/193073071802941451/1078774849188671538

  2. Line of Sight

*Chips Required*

And
Player Get Head Position
Get Position
Get Forward Vector
Greater Than
Is Valid
Rec Room Object Get First With Tag
Raycast
Subtract
Vector Dot
Vector Normalize

*Circuit Graph*

Player Get Head Position --> Subtract (top port)

Rec Room Object Get First With Tag --> Get Position --> Subtract (bottom port)

Rec Room Object Get First With Tag --> Get Position -> Raycast (Start Position)

Raycast (Max Distance = [ Range ] )

Subtract --> Raycast (Direction)

Raycast (Player) --> Is Valid

Is Valid --> And (any port)

Rec Room Object Get First With Tag --> Get Forward Vector

Get Forward Vector --> Vector Dot (top port)

Subtract --> Vector Normalize --> Vector Dot (bottom port)

Vector Dot --> Greater Than (0.5 | or Acos of LOS Angle)

Greater Than --> And (any port)


*Results*

if Greater than && Is Valid are True *(when the And chip is True)*; Player Is In LineOfSight

Else; Player Is Not In LineOfSight
#

@tame remnant

tame remnant
#

thanks

lucid scarab
tame remnant
#

is there a way to use a specific direction?

#

@vocal flame

vocal flame
#

Wdym?

tame remnant
#

nvm

#

i figured it out

#

mb for the ping btw

wicked lagoon