I am trying to create a interactable floor, and when the floor is interacted with, the static mesh changes to make the floor look like it is broken.
How do you want to interact?
⢠by clicking on it?
⢠by looking at it?
⢠by being close to it?
⢠by stepping on it?
⢠by knowing upfront which piece needs interacting with?
⢠by interacting with another linked entity?
⢠user interface elements make us interact with something?
⢠a combination of the above?
⢠something else?
I can see weâre digging for something.
Do note that you can make an entire complex game without ever touching Get All Actors of Class
. Do you want to interact with every floor piece simultenously? If not, then avoid that node like fire.
Generally speaking, you will want some kind of trace or overlap here. But youâd need to tell more about the scenario so we can suggest something tangible.
I want to interact with it by being close to the floor tile and pressing âEâ, but the change static mesh only targets the first or last actor that spawns. I am guessing it is like you said, since I am using the âGetAllActorsâ Node that it is causing problems, is there a âGetOverlappedâ node?
Try this instead:
⢠location is the player
⢠punch in radius
⢠make array of type and set it to the object type of the floor tile / treasure / dig site (itâs still unclear how you need it to work). Is stuff buried under the floor? Or the floor is the treasure?
⢠class is what youâre trying to unearth
⢠actors to ignore can be ignored
is there a âGetOverlappedâ node?
Think of this node as of Get All but location and radius based, with a bunch of filters that allow you to reject undesired results upfront.
maker array of type
More on this in case itâs unclear. Every static mesh can decide what type it is:
So you can ask for only very specific types to be returned:
Itâs a great optimisation in a cluttered world. And more types can be added.
And yet another approach is to give the player a collision volume and use it to scoop things up:
Not as versatile, though.
Thank you very much, I will be sure to try this. The way it needs to work is that the DiggableFloor Actor is a cube SM that upon BeginPlay, a treasure spawns inside of it. So when the player interacts with the DiggableFloor, the static mesh changes to make it appear broken/dug up, which exposes the treasure for the player to collect. There is also a audio ping that is emitted from the treasure that is inside the floor which is meant to help guide the player to the dig spot. Thank you again for your help, I am still pretty new to unreal so I am not sure of what nodes exist, and I have not taken C++ yet so I do not know how to write my own.
***Edit: The DiggableFloor is an actor with a static mesh component
UPDATE: Your suggestion worked perfectly, when sphere around the player overlaps with the DiggableFloor_SM, the player is able to press âEâ to interact, which initiates a digging animation and when the animation is complete, the static mesh is changed to the broken appearance mesh. Thank you so much for your help, I have been banging my head against the wall trying to figure this out.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.