Download

Attach Player Pawn to Actor?

Hello~

I am putting together a game with a small solar system. I’ve successfully implemented planetary gravity using a plugin called CustomGravityProject. Following this I built a few planets and had them rotate in place without too much difficulty. At this point I decided to add orbital movement, by moving the planets along a circular spline.

However, using this motion has resulted in the player bouncing erratically while on the planet, I’m assuming because the planet is moving at an incredible velocity and the player is trying to catch up using the acceleration of gravity.

I think that this problem could be solved if I could set the player’s world velocity relative to the velocity of the planet (and also, I would fix another bug if I could also set the player’s rotation relative to the rotation of the planet). Then any forces and movement to the player will be ‘local’. The simple way I can conceptualize doing this is by making the planet the parent of the player pawn. However, upon trying this I can’t seem to use the AttachActorToActor blueprint to do this. the parent remains unset.

See the attached blueprint for my grounding and attaching code. The Break Hit Result returns a planet successfully, resulting in the string "Grounded, my parent is: " to be continuously printed. Thus, I’ve concluded that the player is not successfully parented to the planet actor. Searching on google hasn’t given me any successful results.

Thank you.