PreviewScene
When opening an animation asset like AnimSequence
, the weapon can be spawned in the animation preview window.
Unlike preview meshes, which are added to the skeleton, different actors can be attached to each animation.
If the HitDetection_HitComponent
notify is used, this setting must be enabled for correct previewing.
Creating an actor class to attach to
Create BP_Weapon
. Here, it is created by inheriting from StaticMeshActor
, but the inheritance class can be chosen arbitrarily.
If you already have a weapon actor to use in the game, there is no need to create a new one; skip to the HitSocketComponent section.
For StaticMeshActor
, set Transform.Movable
to Movable
.
Note that the default for StaticMesh Movable is Static
and cannot be attached as is if the destination is Movable
.
Add HitSocketComponent
Add a hit socket to the weapon. The number of trace points increases with each additional socket, so be careful not to increase it excessively.
Set weapon mesh to NoCollision
Preventing hit detection on self-collision.
Set MetaData in the AnimAsset
Open the AnimAsset and add MetaData
to the asset details.
Select AnimPreview
and set the attachment information to AttachActors
.
ActorClass | Spawning actor class. |
SocketName | Name of socket or bone to be attached. |
RelativeTransform | Adjustment of transformations. |
When AnimAsset is opened for the first time, attachments are not reflected.
This is reflected when another AnimAsset is reopened. This seems to be a bug in the engine; it should be fixed in the future.