What I want is a collider for each part of the body of the character that moves, or a Mesh collider. Is it possible to replace the character controller with a Rigid body, Mesh collider or ragdoll, to make a more realistic collision for characters? And how would you type it in C# for example I have this section of this script where it initializes the character controller for movement:
using UnityEngine;
using System.Collections;
public class TP_Controller2 : MonoBehaviour
{
public static CharacterController CharacterController;
public static TP_Controller2 Instance;
void Awake()
{
CharacterController = GetComponent("CharacterController") as CharacterController;
Instance = this;
}
void ProcessMotion()
{
// Transform MoveVector to World Space
MoveVector = transform.TransformDirection(MoveVector);
// Normalize MoveVector if Magnitude > 1
if (MoveVector.magnitude > 1)
MoveVector = Vector3.Normalize(MoveVector);
// Applyslide if applicable
ApplySlide();
// Multiply MoveVector by MoveSpeed
MoveVector *= MoveSpeed;
// Reapply VerticalVelocity MoveVector.y
MoveVector = new Vector3(MoveVector.x, VerticalVelocity, MoveVector.z);
// Apply Gravity // NO ES ESTE
ApplyGravity();
// Move Character in World Space
TP_Controller2.CharacterController.Move(MoveVector * Time.deltaTime);
}
↧