How to have a child kinematic body halt a parent kinematic body with collision

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By tomarswego

I’m working on a small project to help me learn godot and get more familiar with the project/asset pipelines. It’s a mount and blade-lite experience: the player controlled character (followed by a third person camera) moves around a 3D terrain and kills enemies with medieval weapons. However, my issue is that I have weapon component scenes that are combined into weapon scenes so I can easily create different types of weapons (a spear uses the same animation whether it has a wooden tip, metal tip, or is just a staff), which works great but when I strike someone with the spear for example, the motion of the spear tip is not carried back to the player character, meaning that the player character keeps moving while the spear tip is jammed up against the enemy character’s collision box. Resulting in the spear tip floating around in the air rather than staying in position on the handle.

All of these are built with kinematic bodies, and I’m using move_and_collide to check for the spear tip’s collision.

Is there an easy way to fix this? Or what methods would you all recommend I use to fix it? The options I’ve thought of were: trying to always update the location of the spear tip in local space, extending the collision code to stop the movement of the player character or somehow “slide” them with the collision (I want to avoid this though as it seems like it could make combat very jerky and unresponsive), or simply scrapping my idea for weapon components and using a single geometry with manually defined hitboxes and such (increasing the amount of work exponentially for any new weapon types or configurations, while possibly leaving the same behavior, just with the entire weapon). Anyways, I can post my collision code if it’d be helpful, and looking forward to seeing you guys’ input on it! Thank you so much!

Were you able to solve this? I ran into the same issue (in 2d) and my current workaround is on startup reparenting the collision nodes to the parent. Feels very against the concept :confused:

Swampi | 2020-06-17 20:24