ProceduralMeshComponent doesn't collide with anything
I'm trying to create procedural objects that collide with the world, but I can't make it work.
I'm creating a simple box, with physics disabled; I'm using the First Person C++ template as testing room.
This is the code, executed on an Actor when the game starts:
Then I'm grabbing pre-made cubes that are in the scene and I move them so that they should hit the procedural cube; except that they don't, they pass right through it.
If I grab the procedural cube and move it around, it doesn't hit anything. If I enable "simulate physics" on the procedural cube, it just fall through the ground.
Actually I discovered a method of UProceduralMeshComponent called "AddCollisionConvexMesh", which takes the list of vertices that compose the collision shell basically. That plus the bUseComplexAsSimpleCollision boolean set to false will make the procedural objects behave like they should.
To make the cube behave like any object now I just call that method after creating the section and I pass the vertices of the section to it.
It seems to work fine (the errors are gone), even with more complex procedural meshes! :D
Thanks for the help pulp_user :)
I have not verified this assumption, but here is what I think: You set bUseComplexAdSimpleCollision = false, which means you are telling the engine to not use the visible mesh as collision, but instead some special collision geometry, that is made up of primitives. But you don't provide that. You only provide the geometry, but you tell the engine not to use it for collision. So the engine is left with nothing to calculate collision. If you set this to true, it might work.
answered Mar 03 '17 at 06:33 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here