Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change unity CharacterController center in script

I want to change CharacterController.center, but failed:

CharacterController character = gameObject.AddComponent<CharacterController>();

character.center.Set(0, 1, 0);

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

using UnityEngine;

public class Example : MonoBehaviour
{
    CharacterController controller;
    private void Start()
    {
        controller = GetComponent<CharacterController>();
        controller.center = new Vector3(0, 1, 0);
    }
}

Read the scripting wiki from Unity. https://docs.unity3d.com/ScriptReference/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading