Player Stands ups locked if using rag doll

Silver100

Member
Hi.

Hope you can help on this one,
Player Stands ups locked if using rag doll. I have use ragdoll setting applied but seems to do the same thing no matter what I change. I have even experimented changing layers but player drift off into the sky or locks still.
 
Also tried; directly anim.Play("DieBwd") in an Isdead bool function; Usually works for any animation but not on the player. After updating Unity seems to have run into shader and animation issues for some reason. Even if I could some how rotate player to slurp /full on the ground on the 'X' axis would do for now. At the moment I just have a freeze and game over I guess I could just have a game over animation playing
 
I'm not completely following - what do you mean stands up locked? The ragdoll ability will not have the character stand.

Also tried; directly anim.Play("DieBwd")
This won't work - you instead need to create a new ability to control the animations:


This is the same case for rotating the character.

If you want to play a one off animation you can use the generic ability:

 
Basically I have used the rag doll process added the ability as I would do Jump or any other ability. It wont automatically work. I got it to work before my project crashed but I don't recall following any process like above other than creating a character adding ragdoll wizard soon as I preformed a method for health less than 0 it worked. Is there anyway there can be an Opsive dedicated tutorial on step by step ragdoll process as I'm terrible at following guides. Thanks
 
I have followed the generic process as best as I could but still the same issue something is suspending the player upright even though ragdoll is making the players limbs go floppy. There is no fall back or play of animation just Kind of floats upright the slowly leans.
 
The generic ability is different from the ragdoll ability. If you are adding the ragdoll ability after the fact you will need to make sure you have added all of the necessary colliders. This can be done through the Add Colliders button on the ability. When you are building the character from scratch this is the code that it runs.

1680182432011.png
 
Literally followed all these steps multiple times as carefully as possible. There's definitely a glitch somewhere. The odd thing never had this before just ran the animation I could even set 1 condition to run the death animation in the game. id never heard of ragdoll at that point. Just worked from set up just need the player to lay flat on is dead. The only other solution that's seems to be working is duplicating the character with a seperate animator controller. If I can set the clone character to unparent (like a droppable item) and play the animation on isdead the active character set active false and the clone (to play death animation) should work tricky part is camera get destroyed in the process so need another set up.
 
Is there a simple script I can bolt on to do this function?

I may be getting confused not sure if I need the ragdoll process at all is just getting death animation to work.

what I usually do and never usually fails on player on enemy is the following without even knowing about the ragdoll process

is set up a parameter on the Animator controller for conditions;

Go into the Full Body Layer and add a new Parameter.

Click on Parameters

Go to Plus sign Create an new integer

Name as 'Condition'

On the inspector animator transition base; (The area where you get to tick has exit time etc)

I'm transitioning from idle to death anim. So set is is equal to 1 then DieBWD or what ever your one off animation happens to be.

In my Isdead finction I call a whole bunch of code including

anim.SetInteger("Condition",1); (This usually gets the death animation to play) You drop this line of code in your Isdead code

This is usually fine where you don't need to return to the original state like ide/walking. Death is an exit state.
 
I think that you are intermixing the ragdoll and die abilities which are independent:
  • The ragdoll abilities uses the Unity physics system to move the character's limbs. It does not use the animator.
  • The die ability play an animation when the character dies.
The ragdoll ability can be added through the character manager, but the die ability must be added through the locomotion inspector. It sounds like you want to use die rather than ragdoll.

With that said, you should not call any parameter values directly on the animator. You instead should use the ability system to do it for you. Have you gone through this tutorial?


Based off of your description you should subclass the die class, and then override the GetDeathTypeIndex method with the AbilityIntData index of the animation that you want to play. For an example of the die ability take a look at the revive section within the Die/Revive zone of the demo scene.

This video is also good to follow along to understand how the animator works:


I am off for the weekend but will be able to help if you get stuck on Monday. Good luck!
 
Thanks I will spend some time trying to figure that out in the mean time I have a working solution below for simply getting death anim to play works well for what I need.
I will probably revisit elements when I get better and more familiar.
I'm a bit of a novice at code but this my solution below;

To play death animation direct is possible and actually works. Not prefect but not bad just basic fairly quick solution and not as good as Opsives Die method/ragdoll death;

It's the same principle as a droppable loot item from an enemy. Only a clone of player (model only) is assigned to perform animation task.

The model clone of player is attached to main player. This clone substitutes the player on death becomes unparented (so is not destroyed along with the main player) and is used to play the animation. A separate death camera is attached to this clone and positioned accordingly.

Add an animator controller to this clone and attach animation to be played on awake i.e DieBWD (in state machine just drag a branch to the animation you want).

Attach to player

Create a new camera say called Death camera.

include public variables to drag your camera and cloned player into.

public GameObject Cloneplayer;// drag a copy of your player here must be simply just the model not player with all the scripts attached
public GameObject Deathcamera;//drag your death camera here

void OnTriggerEnter(Collider other)//
{
if (playerCurrentHealth < 0)

Cloneplayer.transform.parent = null;// unlatches clone of player so is never destroyed when player is destroyed.
Deathcamera.SetActive(true);// attached to clone at a death angle view replaces camera so we have a view after original is destroyed.
Cloneplayer.SetActive(true);
GameObject.FindGameObjectWithTag("Player").SetActive(false);// Makes your player vanish
isDead = false;// bool to indicate the above actions represent is dead.i.e less than /<0 and is dead the above events happen.

Order of events is important too often follows logic.

Any further code like return to main menu, would be assigned to the cloned player - as the original player would have course been destroyed.

If you only have 1 main player in the game this works well and the logic is simple and works, but could look confusing in the hierarchy after creating more selectable players.
 
Top