#how do i make a cube activate a trigger with a raycast

3 messages · Page 1 of 1 (latest)

austere bluff
#

its uhh, complicated

#

I can describe a flawless way after school if no one else does

austere bluff
#

Have 2 objects

  • Laser Pointer
  • Cube

Tag the cube with LaserCube and lc0 (0 is index)
Tag the laser pointer with LaserPointer and lp0 (attached cube index)

For each laser emitter:

If the laser is enabled,

Then, Start a custom while loop with 3 variables, Current Position, Current Direction, Hit Object

When the loop is started, set Current Position and Current direction to laser emitter position/direction

On loop, cast a ray in the direction of current position, in the direction of current direction with a length of infinity

Check if the raycast hits an object with Is Valid and that it has the tag LaserCube

If both are true, enable the laser cubes laser via the laser cubes index

If any are false, stop the loop