how to disable characterController's collision detection

can anyone help me? please I need your help anyone, I will really appreciate if someone reply to my question, you are my key to my future

I have a script attached to a cube(the player) a characterController component is attached
into it then, I used the “characterController to make it move” it has collision when interacting with other objects

but what I want to happen is to disable or “remove” its collision feature I don’t want the
cube(the player) to collide to any object “like a ghost that has no collision to anyone”.

I also have in mind to make another alternative script to do this to make the character move without the use of a character controller to make it possible

but I know this is the best and fastest way for me to make the character move.
my only problem is I don’t know to remove its collision detection here is the script that I used please help me.

using UnityEngine;
using System.Collections;

public class player : MonoBehaviour
{
	public static CharacterController CharacterController;
	
	public Vector3 MoveVector;
	public float MoveSpeed = 5f;
	
	void Awake ()
	{		
		CharacterController = GetComponent("CharacterController") as CharacterController;	

	}
	
	void Update ()
	{
		
		var deadzone = 0.1f;
		
		MoveVector = Vector3.zero;
		
		if(Input.GetAxis("Vertical") < -deadzone || Input.GetAxis("Vertical") > deadzone)
			MoveVector += new Vector3(0, 0, Input.GetAxis("Vertical"));
		
		if(Input.GetAxis("Horizontal") < -deadzone || Input.GetAxis("Horizontal") > deadzone)
			MoveVector += new Vector3(Input.GetAxis("Horizontal"), 0, 0);		
		
		// Transform MoveVector to Worlds Space3
		MoveVector = transform.TransformDirection(MoveVector);
		
		// Normalize MoveVector  if Magnitude > 1
		if (MoveVector.magnitude > 1)
			MoveVector = Vector3.Normalize(MoveVector);
		
		// multiply MoveVector by MoveSpeed
		MoveVector *= MoveSpeed;
		
		// multiply MoveVector by deltatime
		MoveVector *= Time.deltaTime;
		
		// Move Character in World Space
		CharacterController.Move(MoveVector);


	}
}

I’d dispute the “best and fastest” bit. CharacterControllers are notoriously difficult to work with if you aren’t doing the (exactly one) thing they’re good for, and they come with a significant performance overhead. You’d be better to just use

transform.Translate(MoveVector);

if you’re going for a ‘ghost’ effect.

ahm sorry for the misunderstanding, I “meant best and fastest” it is the way that I 100% comprehend

actually the code there is from 3dbuzz “third person character setup” if you already heard of it,
I Already tried the transform.Translate and removed the characterController, but when I call the function SnapAlignWithCamera() transform.translate fails to convert the local position of the character to world “global position”

here is the code of the SnapAlignWithCamera()

void SnapAlignCharacterWithCamera()
{
	if (MoveVector.x != 0 || MoveVector.z != 0)
	{
		transform.rotation = Quaternion.Euler(transform.eulerAngles.x, Camera.mainCamera.transform.eulerAngles.y, transform.eulerAngles.z);
	}
}

but if I use CharacterController.Move(MoveVector);

it works perfectly

I just want to know if it is possible to disable or remove the collision of the characterController component, if possible how to do it?

thanks for your answer syclamoth I really appreciate it, but I need the exact answer to my question.

sorry I meant best and fastest because when I use this characterController I will just add a couple of line on my code if I already know how to disable the collision on it, rather than change it to transform.translate because I will be forced to change also the other line of codes, that’s a lot of work. thanks syclamoth for your answer :slight_smile: