A fast moving object passing through other objects

I am new to Unity and am making a small example. In fact, I have a cube that moves with arrows. Now I have walls on the road, and I want my target to hit the wall, but it passed through the wall.

I also used this code, but no result:

http://www.unifycommunity.com/wiki/index.php?title=DontGoThroughThings

+1
source share
2 answers

The general idea is to track the last position of your object (s), and then when they move it casts a ray from the current position to the last position. Check the beam for collisions, and if they are, you are gone, although the object.

, , . .

.

+1

- :

transform.velocity.x += speed * Time.deltaTime;

, , . , INSIDE .

+1

Source: https://habr.com/ru/post/1524542/


All Articles