ThirdPersonController collision not calling OnTriggerEnter event

后端 未结 2 1441
醉话见心
醉话见心 2021-01-28 15:45
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour {

    public Transform target;

    // Update is calle         


        
2条回答
  •  梦谈多话
    2021-01-28 16:14

    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");
    }
    }
    

提交回复
热议问题