Quantcast
Channel: Questions in topic: "ragdoll"
Viewing all articles
Browse latest Browse all 565

Ragdoll help

$
0
0
Hello, I am trying to make a script where the enemy turns into a ragdoll after his health is less than or equal to 0. Also, the enemy has an animation, so i'm trying to make it where the ragdoll gets disabled and the animator gets enabled, then vice versa when he dies. But I keep getting these errors that I don't under stand! If anyone can help, here is my script and errors:![alt text][1] ` using UnityEngine; using System.Collections; using System.Collections.Generic; public class Enemy : MonoBehaviour{ public Animator death; public float health = 50f; void Start() { setRigidbodystate(true); setColliderstate(false); } public void TakeDamage(float amount) { health -= amount; if (health <= 0f) { Die(); } } public void Die() { //death.SetTrigger("IsDead"); GetComponet().enabled = false; setRigidbodystate(false); setColliderstate(true); } void setRigidbodystate(bool state) { Rigidbody[] rigidbodies = GetComponentInChildren(); foreach (Rigidbody rigidbody in rigidbodies) { rigidbody.isKinematic = state; } GetComponet().isKinematic = !state; } void setColliderstate(bool state) { Colliders[] colliders = GetComponentInChildren(); foreach (Collider collider in colliders) { collider.enabled = state; } GetComponet().enabled = !state; } }` [1]: /storage/temp/166911-screenshot-12.png

Viewing all articles
Browse latest Browse all 565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>