Using rigidbody for collisions only, not movements?

Hi,
i have read that we can use a characterController and a rigidbody set to “kinematic”, and then turn off the kinematic when there is a collision. How could we do this? I have this kind of code :

function seekPlayer(){
	var moveDirection=Vector3.zero;
	directionToPlayer=player.transform.position-transform.position;
	distanceToPlayer=Vector3.Distance(transform.position,player.transform.position);
	
	var playerAngle=Vector3.Angle(directionToPlayer,transform.forward);
	
	if((Mathf.Abs(playerAngle)<visionAngle && distanceToPlayer<visionRange) || canSeePlayer==true){
		Physics.Linecast(transform.position,player.transform.position,hit,~sameLayer.value);
		moveDirection=transform.forward;
		if (hit.collider.name==player.collider.name){

and when i add a rigidbody to my characters, i get a reference null at :

if (hit.collider.name==player.collider.name){

Is it possible to still use the characterController to move the character, and the rigidbody to simulate the collision only?

Thanks

You’re mixing-up rigidbody and collider. Collisions entirely relate to colliders. Rigidbody is not involved in collisions or raycasting. Hopefully that helps in some way, cheers