Witam, przerabiam poradnik od Unity https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial/collecting-pick-objects?playlist=17141
I natknąłem się na pewien problem. Kiedy kulka wjeżdża w klocek, przenika go, ale klocek nie znika.
Czy ktoś wie jak rozwiązać ten problem.
Screen z Unity https://imgur.com/a/K78KtPC
Kod z player kontroler
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControler : MonoBehaviour
{
public float speed;
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
private void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal,0.0f, moveVertical);
rb.AddForce(movement * speed);
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Pick Up"))
{
other.gameObject.SetActive(false);
}
}
}
}