The reason why Unity sets the rigid body and the collision body but still passes through the wall

        When I was doing 2D game practice, I found that the zombie can still go through the wall to chase my protagonist after setting the collision body and rigid body.

         First, I took a look at Edit-->projectSetting-->Physics to see if their collision was checked.

         I found that this was not the reason, so I checked the code again, and found that the 2D behind any function was not dropped. After searching for two days, I finally found out that I had selected Kinematic as the Body Type, so that the collision would only be controlled by the code, and it would be fine to change it to Dynamic. I really vomited. .

 

 

 

Guess you like

Origin blog.csdn.net/weixin_63484669/article/details/128089280