0 votes

Hi,

I'm trying implement a ragdoll effect in my 2D game. This is done by instancing a PackedScene ragdoll (made of Rigidbody2D) and adjusting each limbs' position and rotation according to those of the original player. This works when the player's scale.x = 1, but is no good when flipped horizontally so scale.x = -1. The ragdoll appears to explode.

With a bit of research I think this can be sorted by using some of the Transform2D methods, but I'm not sure exactly which ones. I think the process should be:

  1. Get player limb position and rotation.
  2. Get player scale and rotation to determine player's local x-axis.
  3. Flip limb position along player's local x-axis.

Could anyone explain how this might be done in GDScript? Thanks

asked Apr 16 in Engine by camarones (101 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.