I tried make a Ragdoll game with my brother but the problem is that we try make a Ragdoll movement and we can make a movement but when we try this movement on the Ragdoll It just goes pretty normal. we know we need bones and things like that but we don't know how can we make A script like that. we don't want see tutorials on YouTube we want to make a script that how We want to be. Anyone have any idea how we can do that? Oh and I know when I wrote this there were some spelling errors in the above code so sorry for that. here's our script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
// Start is called before the first frame update
public float force;
public Rigidbody2D body;
public Leg[] legs;
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.D))
{
Vector2 vec = Vector2.right * force;
body.AddForce(vec);
foreach (Leg leg in legs)
{
leg.Walk();
}
}
}
}
[System.Serializable]
public class Leg
{
public Rigidbody2D bone;
public float walkRotation;
public float force;
public void Walk()
{
bone.MoveRotation(Mathf.LerpAngle(bone.rotation, walkRotation, force * Time.deltaTime));
}
}