Collision detection failure w/ assets from the unity asset store

I just completed video #37 creating terrain. At the end of the video, we are encouraged to layout our map, level, world etc…I have a problem that I can’t figure out.

I added assets I downloaded from the unity asset store. Ethan is able to run through those assets on my map. I have set the assets layer to my layer that isn’t walkable (my layer is called “nonwalkable”).

What am I missing?

Hi Matt,

I don’t know what type of assets you are referring to, e.g. buildings/characters etc, I’ll assuming buildings as you said you have an issue with Ethan walking through them.

Assuming your new assets have colliders, and Ethan should already have a rigidbody and colliders, the next thing to check would be whether you’ve re-calculated your navmesh after placing those new assets. Ethan may be using old navmesh data that you created before adding those assets to your scene. Also, if it is buildings or walls that are to stay in position and not move, you should set them to static, certainly for the navigation.

The non-walkable layering is only really going to affect where you can indicate Ethan to actually go, it wouldn’t stop him travelling through something if there is nothing blocking his way, or if the navmesh data indicates he can walk that way.

Hope this helps :slight_smile:

1 Like

That was it. The assets did not have colliders on them. I added a box collider and that “fix” the problem (not entirely in the case of an irregular shape but good enough for now at least).

You could instead use a mesh collider.

Were these assets scenery or characters?

Scenery … they are from polygon.

I am interested in characters too, but not important for now.

Did you re-bake the navmesh too? If you lift one of the assets up a bit, if the navmesh is under the asset you probably want to re-bake, unless its a model the character is supposed to be able to move inside. After re-baking, lift the asset up again and you’ll see the areas where the navmesh doesn’t cover - this will stop your characters from trying to walk on/in those areas :slight_smile:

I have to say no :slight_smile: as I’m not sure what that is…yet. I’m just at lesson 38 so I have lots to learn.

Ah, ok, I assumed as you said about Ethan walking through the models that you had the point and click functionality already, guessing you are still using the keys to move around?

Assuming so, this gets changed later, and then in these situations you will need to rebake the nav mesh :slight_smile:

Ah. I am using both keyboard and point and click movement. I haven’t decided if I want one, or the other, or both.

The collision problem occurred with both. And adding the box collider fixed the problem for both.

I am not sure what rebaking the mesh means…however, it sounds like I will learn that in up coming sessions.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms