0
votes

first of all, i'm new to the world of Unity Game Development but i do have an established experience in working with C#. I'm working with UFPS out-of-the-box using Modern Ruins' Demo Scene as the primary map. And for some reason, the default player (HeroHDWeapons) is passing through each and every objects on the map: walls, posts, literally everything.

However, i also have a humanoid asset for use on my AI/BOT using Low Poly Soldiers, also out-of-the-box, and i just added a Capsule Collider, yet he doesn't pass through wall - or maybe since he's using a Nav Mesh Agent for his movement.

I've tried everything i know for my Player model based on what i've learned from basic unity tutorials. I added a RigidBody Component, which makes my player fall off the map with the "Use Gravity" option ticked but regardless, still passes through walls. I also tried adding a Capsule Collider, still passes through.

I did try adding a Capsule Collider on one of the objects on the map, and the player suddenly stopped passing through it. Of course, adding a Collider Component on each and every object on the map is not a good idea - considering there are multiple hundreds of them.

Here is the player model's properties: enter image description here

P.S.: i've already done my fair share of research but none of them works. except for those talking about using other syntax like Rigidbody.MovePosition(Vector3) as i don't know what it would impact on the entire UFPS Framework.

1
you cant expect to detect a collision with anything that does not have a collider. simple as that. my advice is add colliders to big objects and level objects, but not all the clutter. stuff like walls, barrels, crates, the obvious big objects.Technivorous
@Ruzihm no it is not a duplicate, i do not fall off the ground. its just that the player is passing through walls.Nii
well that's nasty @Vanethrane, guess the only way around is to put colliders in the map objects? there's literally many of them.Nii
@Nii It's a possible duplicate because the same answers to that question address yours as well.Ruzihm

1 Answers

0
votes

You need Colliders. Simple as that. pick and choose what objects to collide if it makes it easier. note that the unity Engine can ONLY handle 65536 different colliders at a time, only. lol.

According to the Unity3D documentation:

"Note that the PhysX engine used by Unity only handles a maximum of 65536 colliders in a scene."