Spawn actor to a specific location

Hello everyone,

In my game, I spawn weapon using the node “Spawn Actor from class”.
For the moment, I spawn my weapon using the following nodes :

I spawn the sword to the location of the socket WeaponR in the world.

But I would like to change all of that. In fact, I have many weapons in my game that come from free assets pack and marketplace. For these reason, meshes have not the same center or the same rotation.
I made a datatable that store the transform where I should spawn the weapon in order to be at the perfect place.
I obtain this transform by creating a previsualisation asset on the socket WeaponR in the skeleton and move and rotate the socket to have the perfect location.
My problem is that I don’t know how to use this transform to make the sword spawn perfectly in the world.

If we go back to my nodes, we see that we spawn the actor at the socket place in the world. But I would like to spawn the actor at a precise transform from the socket place in the world.

Would someone help me to solve that ?

Thank you very much for your help !

All the best.

Hi, after you spawn the actor attach it to your mesh. When you attach it set the location to “Keep Relative” and set the relative location you want (so the weapon will keep this relative location from where its attached to).

And you would use “WeaponR” as Socket Name. Basically what “AttachToComponent” does, is your weapon will move with the socket. So if the socket would be your hand, then when your hand moves the weapon will move with it. And “KeepRelative” means your weapon will not have the same location as the socket, but will keep the relative location from the socket (so you can also add a relative rotation or scale).

2 Likes

Wonderfull ! It is what I was looking for. It works well like this. Thank you so much !