Create dead character with rigidbody2D and joint

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mohsen.ph.69
:warning: Old Version Published before Godot 3 was released.

Hi I have 2 question
First
I need that my character to be kinematicbody2D then when my character die I need it to become a rigidbody2D connected with joint! Is that possible?
Second
Also when I connect them with joint is there any way to constraint the two rigidBody to only have certain degree, For example I want to knee bend only backward, Is That possible

:bust_in_silhouette: Reply From: bruteforce

Hi,

First:
I had a similar issue, and my solution is not perfect at all, so I’m also curious :).
I used KinematicBody2D (name: “player”) as character controller, and I replaced it (runtime with gdscript: remove_childadd_child) with the joined RigidBody2Ds (name: “corpse”) when the player died.

Second:
Add a collision polygon (draw it properly!) to the rigidbodies, and uncheck the (pin)joint’s exclude nodes checkbox!

Here is my result:
enter image description here

There are many difficulties (ie: initializing the “corpse” rigidbody parts according to the player’s last status),
and strange behaviors especially if you override the default gravity… so it is not so easy.

My related topics:
https://forum.godotengine.org/12777/rigidbody2ds-and-pinjoint2d-anomaly
https://forum.godotengine.org/12960/rigidbody2d-initial-scale-rotation
https://forum.godotengine.org/12702/connect-2-rigidbody2ds-with-a-pinjoint2d

Hope it helps!

If you find a simpler/better solution, please tell me!

Hi
Thank you for your answer
That is great
I will work on it and If I can find a better way I will let you know

mohsen.ph.69 | 2017-11-03 06:31