I’m working on a game where the player shoots itself towards objects, and it should ledge on them, so that when these objects move, the player will move with it. To get this result, I’m making the player a child of the object it collides with via the following blueprint:
This seems to work just fine. After that, when the player shoots itself somewhere else, it should detach from the object and move again, but when I try to do that (both in C++ and blueprints), the velocity is a zero length vector and the player just freezes at the spot it clicked. I detached the player in C++ with the following code:
this->DetachRootComponentFromParent( true );
And with the blueprint called “Detach Actor from Actor”.
The velocity gets set with the AddImpulse function as follows:
collider->AddImpulse( SpawnRotation.Vector() * movementSpeed, NAME_None, true );
For both cases in the hierarchy it looks like the player has indeed no parent anymore.
Also the player’s mobility is still “moveable” (I also check this in C++ to be sure, and it prints it’s true).
The “Simulate Physics” option is still set to true (or maybe I’m looking wrong…).
I don’t know why the player is not moving after it had a parent. Thanks for the help in advance.