Hi ! I made two BPs, one to give bonus to my character (mesh = sphere) and a moving plateform. I’d like to put the sphere onto the plateform for both moving at the same speed but I don’t find a way to attach them properly. Is there any way to do it whitout using C++ ?
How does the Moving Platform work? How are you moving it?
If the whole Actor moves, You should be able to drag the Bonus BP on top of the Moving Platform on the World Outliner and it will get attached.
If you’re only moving the mesh inside the Moving Platform, You can use the Attach Actor to Component node to attach the Bonus BP to the Platform :
In your Bonus BP, you could do a LineTrace straight down to see if it hits a Moving Platform, and if it hits, you could get the Component that it hit and use the Attach Actor to Component node
Thanks for your reply.
The node Line Trace By Channel works correclty but I struggle to use the Attach Actor To Component. Can’t connect with the BP of the moving plateform without having error in my code. I use the Cast To… node but maybe there is a better way to get it in the Bonus BP ?
Ok thinking about it a bit more, a better way to do this would be to have an Actor Reference Array variable in your Moving Platform and then add the actors you want to move with the platform to the array.
Then in the Moving Platform, you can loop through the array and attach all actors in it to the platform.
-
Create an array variable of type Actor (Object Reference), Set it to Instance Editable.
-
In the level select your Moving Platform, and add all the actors that you want to move with it to the array.
-
Create a function called Attach Actors and call it from the Construction Script or Begin Play (I suggest using Begin Play).
-
In the Attach Actors function, Loop the array and Attach each actor to Moving Platform, Set all Rules to Keep World.
Result :
It works perfecty, thanks !
Just a bit of an issue when the BP_Bonus respawn ; it doesn’t attach back to the moving plateform and stays static. Could it be about the way the Bonus spawns back after being destroyed ?
I put screenshots of how it works in the BP_Bonus :
If it gets destroyed, you would’ve to re attach it when you spawn it again.
From which blueprint is these screenshots from? is it the Moving Platform?
No, it’s from the BP_Bonus.