1
votes

I have been following the Unity 2D rougelike tutorials. The inspector returns no console errors when run.

The player moves on a grid and should collide with objects, some should trigger upon moving over them and others should prevent movement, the objects that activate upon trigger work as intended. The player has a Rigidbody 2D and Box Collider 2D and is set to is kinematic. The objects that do not work as intended are the walls, the outer walls should block movement entirely, the inner walls should be breakable and the enemies can not be damaged or damage the player. The walls all have a Box Collider 2D. The enemies also have a Rigidbody 2D and is set to is kinematic Game

1
So is your problem that the walls don't block the player?I.B
@CNuts that is correctFarhad Khan

1 Answers

1
votes

It's normal that the walls don't block your player. You have set the isKinematic to true. What that does is

Controls whether physics affects the rigidbody.

So when you set it to true, physics no longer affect your player and he will not collide with anything.

From the Unity documentation:

If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position.

You should set the isKinematic to false if you want your player to be able to colllide with different objects.