D
D
dani220232021-12-11 13:15:03
C++ / C#
dani22023, 2021-12-11 13:15:03

Problem with BoxColider?

Good afternoon. The problem is this. On the obstacles is a BoxColider, exactly in the center. I wrote a code so that when an obstacle and a character collide, time stops and the "lose" panel is displayed. When I tried to play without this code, everything was fine, the character was not affected by the colliders if he ran past the obstacle. But when I turned it on, at a long distance, the collider somehow hit the character and the game ended.

void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (hit.gameObject.tag == "obstacle")
        {
            losePanel.SetActive(true);
            Time.timeScale = 0;
        }
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
stasersmailov, 2021-12-11
@dani22023

maybe the problem is that the collider on the player itself is very large or just in that place there is a collider without an object

F
freeExec, 2021-12-11
@freeExec

There are no problems with BoxColiders. Or what answer would you like to hear?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question