x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I enable collision for custom mesh at runtime?

I've successfully assigned an array of triangles to a custom mesh, and it's displaying just fine. What would be the best way to enable collision for this mesh during runtime? I want the player to be able to walk upon the mesh.

I am using a 3d simplex noise function in C++ that I've exposed as a blueprint node to generate the terrain on the fly, seeding a random float to the Z value for randomization, using the rest of it as a 2d noise function (hope that makes sense). Long story short, I'm generating random terrain via custom mesh triangles, and I want to walk on it.

Here is my unsuccessful attempt to add collision: alt text

And here is the screenshot of the custom mesh triangles in case anybody was interested in seeing what I've got so far (they still don't have collision though): alt text

I'm also trying to find out what other problems I might run into in terms of AI, navmesh, and level streaming using a noise function to generate a world. As far as I know, there aren't a lot of examples of this type of world generation in UE4, and I'm interested in what kind of trouble I might run into later, but I'll save those troubles for other questions, right now I really just want that collision!

If there is a better way to generate terrain like this, I'd love to hear it as well.

Product Version: Not Selected
Tags:
terrianbp.jpg (107.1 kB)
more ▼

asked Oct 03 '14 at 01:24 PM in Blueprint Scripting

avatar image

dahZee
6 1 2 3

avatar image dahZee Oct 04 '14 at 12:43 PM

It would be really neat if there was a way to feed my noise height values to a landscape at runtime, and use that instead, but as far as I know, that is not supported for landscape.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

As far as I know, this is currently not available by default in the custom engine.

A developer says something may be available in 4.5(Which is currently in preview) here: https://forums.unrealengine.com/showthread.php?2695-Implement-Runtime-Collision-Detection-for-Procedural-Generated-Meshes&p=137073&viewfull=1#post137073

I did a bit of testing with this and it worked but it was extremely slow: (I did not troubleshot why it was so slow and it may be a simple fix) https://wiki.unrealengine.com/Procedural_Mesh_Generation

more ▼

answered Oct 13 '14 at 12:52 AM

avatar image

MJ_01
822 38 39 240

avatar image dahZee Oct 13 '14 at 05:39 AM

Yeah from what I read, it doesn't support non-editor physics cooking at runtime, although i might mess around with some of the code snippets from the wiki example. Thanks for replying though! hopefully there will be a way to do it in 4.5

avatar image MJ_01 Oct 13 '14 at 05:42 AM

I'm hoping for the same thing. I downloaded the preview but haven't had much time to screw around with it.

avatar image dahZee Oct 13 '14 at 10:19 PM

It would be cool if they made a blueprint node for making physics collision primitives with vertices or something like that. I don't know exactly how the system works for assets generated at runtime though. I'm sure i could extend and expose some things to make one though if I dig around in that example.

avatar image MJ_01 Oct 13 '14 at 10:26 PM

That's what I did and was running into an extreme amount of hanging. It would be best to create the mesh and collision in a separate task and then place in the world when it is finished.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question