is that kind of behavior is what you want?
if you want that kind of behavior, you can start by creating an Actor Class that will be used for the location of the object and the object type. After done creating the class, you need to organize the actor all across the map.
The one in the wall is kind of object that can only be placed in the wall, and the one in the floor is kind of object that can only be placed in the floor.
This is my class for organizing the object placement:
...
UCLASS()
class MEDIEVALPANDEMIC_API ATrapPlacement : public AActor
{
....
private:
/** Sample Mesh Component */
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Component", meta = (AllowPrivateAccess = "true"))
class UStaticMeshComponent* SampleMesh;
/** Box Component for placement detection */
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Component", meta = (AllowPrivateAccess = "true"))
class UBoxComponent* PlacementDetection;
/** Invisible Trap class that spawned here */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Trap", meta = (AllowPrivateAccess = "true"))
class ATrap* InvisibleTrap;
/** Trap class that spawned here */
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Trap", meta = (AllowPrivateAccess = "true"))
ATrap* RealTrap;
/** Trap Placement Category */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trap", meta = (AllowPrivateAccess = "true"))
FName TrapCategory;
};
Later, you just need to do a LineTrace from the character and if the traced actor is an ATrapPlacement (this is the object placement you already spread in the map), then you can check, what is the Category of that placement? is it for the Wall? is it for the Floor?
if it match, you can just spawn the object there. Overall the algorithm I use is like that, if you want further explanation you can just reply this and I will answer it if I can. I’m sorry I can’t upload the project due to the size