Regarding actor movement and Root Components
In most of the tutorials I have seen, an empty scene object is used as the Root Component of many actors. I am wondering how should I correctly be moving my actors if my other components are attached to the root, this is my current hierarchy:
I have a static mesh which is attached to an empty scene object. I am adding forces to this actor like so:
Is this correct?
The reason I ask is because I am currently trying to get a ball actor to follow a paddle actor before the ball is launched, but the ball remains in place and does not move with the following code:
However, the ball will follow the paddle if I remove the empty scene component from the paddle and set the static mesh component as the root like so:
I feel like something I'm doing wrong is incorrect, am I correctly setting Root Components? Do I have my movement logic wrong? Any insight would be appreciated.
A good point was made by Crowley Caine, after checking some of the pre-delivered templates, Epic don't appear to use the empty Scene Component as the root.
But I believe the issue I had here was that I was setting the BallMeshComponent Location to the RootComponent of the Paddle, but the paddle movement is done on the PaddleMeshComponent and not the Root, so the code was behaving as expected.
What I should have been doing was setting the ball movement to the PaddleMeshComponent (as this was the actor that moves, not the root) so by changing the code from
The ball now moves with the paddle as expected.
answered Apr 20 '19 at 12:14 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here