Hi everybody. There is a spaceship, it flies, picks up weapons at the level, adds it to the array (its arsenal) and by pressing the button it will spawn the desired weapon on the socket. I tried to do it through SpawnActor, but in this case it is necessary to add weapons to the array in advance, and I want to do everything dynamically. Spawn via Static Class seems to spawn the weapon, but does not attach it to the socket. Can you tell me the right direction?
The weapons are separate Actor
The Spaceship is an Actor
there’s a node called “Attach Actor to Actor” - you also have option to select bone (or Socket) where you wanna attach it
Run this piece of code, or rather the single node right after you collide with Weapons to pass info which weapon was picked up
Also IF Weapon Actor is the same actor for picking up AND shooting - you don’t have to spawn a new Actor but just Attach what you collided with
But if you have Weapons_Collectible as separate Actor and Weapon_ToShootWith separately - you need to pass info about the Weapon, attach and afterwards Destroy
Do not destroy first the picked up Actor - otherwise you’ll loose info about it as it’s simply not existing anymore
Yes, but this does not solve the question of how to spawn a weapon from an array without using TSubclassOf.
Ahh, my bad, you’re using CPP, not Blueprints
That’s not my area so unfortunately you’ll have to wait for someone else
Have you tried playing with Child actors? I’ve been using it in my game, and works flawlessly.
For example plz?