using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour {
public Transform target;
// Update is calle
Every thing is correct but the thing wrong here is you are changing the position of the object which is colliding with a second object , but the thing id the thing is the collider is already there..... As it's alternative try to print any statement when collision happens like this
private void OnTriggerEnter(Collider other)
{
if (other.tag==your_tag)
{
print("message");
}
}
ThirdPersonController
uses CharacterController and OnControllerColliderHit is used for that not OnTriggerEnter
.
Note that you must move it with the Move function not directly by its transform in order for OnControllerColliderHit
to be called.
void OnControllerColliderHit(ControllerColliderHit hit)
{
}