Create a decal actor to which actors can be attached?

I’m trying to create an actor to which held actors can be attached. The idea is that when you pick up an actor, let’s say a hand-held tool, it can only be put down in a specific place. I want to make a decal, that can glow in a certain colour, which indicates that the glowing surface is a “placing zone” for the currently held actor.

So my idea right now is the following:

  • Create Decal Actor Blueprint Class
  • Give it the following variables:
    • IsOccupied => Boolean that indicated if the placing zone is occupied
    • PlaceAbleType => Actor Class Ref that indicated what type of actor can be placed.
  • Make PlaceAbleType instance editable
  • Make Decal extents a flat surface
  • Set periodically Flashing Material as Decal Material
  • Implement Interaction interface in Class Settings
  • Make Blueprint logic that can detect if the player is holding an actor of Class PlaceAbleType and then use Attach Actor To Actor to attach the actor to the Decal.
  • Set IsOccupied to True
  • Make Blueprint logic that can detect if the player isn’t holding an actor and then use Detach Actor and attach Actor to PhysicsHandle of FPSCharacter.
  • Set IsOccupied to False

Is this a good idea? Should I use something else as a base class?

Is this a good idea?

Sounds good to me.

If the functionality of the decal placing is going to be complex, absolutely make it into an actor. Either extend the decal actor class or make your own actor with a decal component.

For all things simplistic, one could probably get away with just decal component instead, working exclusively in world space and attached to a pawn or some other manager actor.

One issue I have discovered with Decal Actor as a base class:

You cannot set the Decal size in the construction script as far as I can tell. So I have to decide on a decal size once and then cannot adapt that once I make a placing zone for another actor, which might be significantly bigger or smaller.

Do I just not see it or do I need to change something fundamental?

Or is it that the Decal Size is an instance editable anyways and so it will be manually adjusted to any given instance by me anyways?

It’s about the component itself rather than decal actor class. Afaik, decal size was deprecated. Think of decal size as of base size (closer to mesh size in a static mesh component). Use component / actor scale to control decal size instead.

edit, this:

Decal size in local space (does not include the component scale), technically redundant but there for convenience *

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Decal, meta=(AllowPreserveRatio = "true"))
FVector DecalSize;

No clue why they think it’s redundant, I find it handy.