Tracing MultipleActors and acting per Priority
Hey all, I'm working on a generic player interaction function using a spheretracebychannel (mostly following the recent blueprint communication livestream vid),
Essentially I've got a player character that traces the sphere ahead of him and tells an actor to "Do Something" and that something of course depends on the actor, I've got the basic functionality working great and am now curious about going a bit deeper with it. Specifically how would i go about Getting multiple traces within range & also assigning priorities levels to objects so that if I trace multiple or overlapping interactables only the highest priority one would fire?
For example: Im working on a treasure chest, that randomly spawns loot on interaction, My current test scene includes a Loot Container That when interacted will randomly choose an item to spawn inside and then animate opening the chest (btw the container also can close on a second interaction). All of this works great. But if i want to make the spawned item inside using the same interact key I'd need to kill the chests collision object. But since i want to be able to reclose the container, is there perhaps an alternate way to go about this?
My initial thinking was try to use the multispheretrace and then some how break the results, then looking for two variables perhaps an INTERACTABLE? boolean to flag any actors containing the functionality, then maybe use an integer variable called PRIORITY on different objects to determine the Priority of which should be the receiver of the interact function. Buuuuut im not sure how to proceed from where i am.
Pics included are my interact function pretty much direct from the livestream & my Hyrbidized Lootcrate on Interact function. Any suggestions, teaching tips or habits you guys could pass on would be much appreciated :)
EDIT I should have mentioned that i'm doing a top down overhead JRPG style game, Otherwise a simple line trace probably would have been enough.!
Follow this question
Once you sign in you will be able to subscribe for any updates here