- Home /
Question by
Rainmaker · Apr 03, 2014 at 10:57 PM ·
gameobjectphysics2d.raycast
How do I get characters to interact with each other?
I am trying to make a classic top-down rpg. I want to make it so that when the player character faces an NPC and presses A, a dialog box pops up. How do I get the player character to interact with a character in front of him? Physics2D.raycast isn't working for me.
Comment
Answer by xt-xylophone · Apr 03, 2014 at 11:02 PM
You could use a box collider set to a trigger just in front of your character and when you press the desired key, check if anyone is in that trigger and that's the guy you interact with.