playMaker

Author Topic: Assigning multiple objects hit from a single raycast to a single variable  (Read 1636 times)

mrpooley92

  • Playmaker Newbie
  • *
  • Posts: 2
Hey, guys! I'm building a movement system for a strategy rpg game. I'm trying to change the color of the tiles that are in the players range. When trying to build this system, I began raycasting from the player to hit the nearby tiles within range. It does work for the first tile hit - but the problem is I want to store all of the tiles hit in the raycast in a variable (or maybe an array? I have arrayMaker) so I can change the color of all the tiles hit in the raycast.

Anyone know how to solve this?

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Hey, The way I'm doing this in my puzzle game is to parent empty game objects to the player in each position of its movement range. Then on these range objects, I use find closest object (with tag) to get a hold of stuff in the player's range. Kinda different approach than raycast, but it works for me so far.