- Home /
How To Create 2D Ragdoll Movement?
I've been messing around with ragdolls in unity and I can't seem to put together the kind walking I want from the ragdoll
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class playerMovement : MonoBehaviour
 {
     public Rigidbody2D rb;
     public float speed;
     private float moveInput;
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void FixedUpdate()
     {
         rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
     }
     private void Update()
     {
         if (Input.GetKeyDown(KeyCode.D))
         {
             moveInput = 1;
         }
         if (Input.GetKeyDown(KeyCode.A))
         {
             moveInput = -1;
         }
     }
 }
This works more or less but instead of walking the ragdoll slides on the ground instead. Anyone have a better way of doing this?
Answer by Pangamini · Nov 19, 2019 at 01:03 PM
Why would you expect it to walk, from your code, you are just applying a velocity? I assume that your ragdoll is a bunch of bodies and joints. To make a physical ragdoll walk, well, take a look at Boston Dynamics and their walking robots, ask if they have some public libraries. Because this is not a trivial task at all.
You'd better go with some faking, playing an animation and switching to a ragdoll when needed (when hit, for example). Or take a look at Euphoria engine, they had very interesting results. Or experiment with neural networks, I don't know. But one think is for sure - this is not a simple "how to" task.
Follow this Question
Related Questions
[2D] Moving the player 1 tile at a time using rigidbody movement 0 Answers
How to push an object in 2D grid style 0 Answers
Creating 'redstone' like wires 1 Answer
Horizontal attraction? 0 Answers
2D Trajectory Curve,Display trajectory while dragging 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                