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"

Collision for procedural mesh generation

Hello all!

I use this link, and this link for making collision for generation meshes. I try include Physic Simulation and after that my mesh flying into the floor and remove from level. If i hadn't it , my character can jump on it and stoping.

Code which make mesh:

 PrimaryActorTick.bCanEverTick = true;
     
     Mesh = CreateDefaultSubobject<UCustomProceduralMeshComponent>(TEXT("ProceduralCube"));
     
     // Generate a cube
     TArray<FCustomProceduralMeshTriangle> triangles;
     GenerateCube(100.f, triangles);
     Mesh->SetProceduralMeshTriangles(triangles);
     Mesh->SetMobility(EComponentMobility::Movable);
     Mesh->SetSimulatePhysics(true);
     Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
     
     Mesh->AttachTo(RootComponent);
 //    RootComponent = Mesh;
     SetActorEnableCollision(true);
 

How i can include physic simulation and get correct work?

P.S.: I use MacOS.

Thanks for help!

Product Version: UE 4.10
Tags:
more ▼

asked Mar 15 '16 at 08:51 PM in C++ Programming

avatar image

Alexey Helmer
31 4 5 5

avatar image Alexey Helmer Mar 15 '16 at 08:53 PM

And this link i read too)))

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

UProceduralMeshComponent::CreateMeshSection(int32 SectionIndex, const TArray& Vertices, const TArray& Triangles, const TArray& Normals, const TArray& UV0, const TArray& VertexColors, const TArray& Tangents, bool bCreateCollision);

When you're building the mesh, make sure to set the bCreateCollision flag..set the collision channel response as you require and it should work fine.

more ▼

answered Apr 22 '16 at 08:30 AM

avatar image

mid_gen
11 1 2

avatar image 143258 Nov 12 '16 at 02:39 PM

Thanks that helped me a lot : )

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

In my case, when using UE 4.17.1 and procedural meshes, the collision only worked in preview mode, but in launch mode, they would not work even with the above suggested flag set to true. I had to add the following line after setting up mesh data:

 // Activates building collision data
 mesh->ContainsPhysicsTriMeshData(true);
more ▼

answered Aug 21 '17 at 02:59 PM

avatar image

vbs
31 3 8 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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