Hi!
I’m making an interaction system for my game where users can press a button on their keyboard to interact with a variety of objects (doors, etc) and I’m wondering about how to delegate the behaviors for interactions. Following the advice of this post: Pressing "E" to interact? Is it simple? - #3 by serverIess , I currently have a system for detecting when the player is near an interactable object, and displaying a billboard gui that tells the user to press e. Now I’m trying basically trying to fill in this part:
if Magnitude <= 10 then
-- RUN SOME CODE
end
which governs the interactions themselves. The above statement will fire for any interactable object, and I was wondering what you would recommend to handle the task of doing different things for each object. I was thinking of storing a dictionary that maps models to their respective functions, but is there something better, or more elegant? Is there a golden standard for this or what are the options?
Thanks a ton!