How to connect two entities?

Hey everyone!

I’m working on arrow shooting game.

What I have right now: arrow flying functionality, based on physics, and when arrow collides into something it stops moving and stays in the same position as it was in the moment of collision.

My enemy/target has ragdoll mechanics, so when my arrow reaches the target, the enemy is thrown forward. But as I mentioned before, the arrow stays at the same position as it was in the moment of collision. So I have something like that in result:

The arrow is just staying somewhere in the air.

What need to do: if I reach the target, I need for my arrow to stick in. And if the target is thrown forward, I need my arrow to be a part of the target and tp move with it.

Can you give me some advices how to do it, so both arrow and enemy/target are moving correctly together?

Thank you in advance!

Hi @HPomirko,

I think I understand what you’re trying to do, but my advice might be a little off without a project to look at.

I’m not sure if you’re stopping the physics on the arrows once it hits an entity in code, but it could explain why the the arrow stops. You will actually probably want to do that anyway if you want it to then be attached the entity it hit and fly with it.

If I were to approach that problem, I would stop and remove the physics from the arrow in hit and then reparent the arrow to the hit entity. Once that is done, you can move the hit entity however you wish and the arrow will follow with it.

I hope this is helpful.