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"

Help adding procedurally generated mesh code into a project

Hi all, so I was told about this: https://github.com/SRombauts/UE4ProceduralMesh/commit/728cd931d2f0bde7359168ffcc863bfbbaa8c718

github page which has code to give your procedurally generated mesh collision. I have no idea what to do or where to start. I've already made a .cpp and .h file which are customMesh classes called

GenertatedMeshComponent

My project is called

TriKakei

when I try to copy the respective .cpp and .h files found on the github page, into my .h and .cpp files I get tons of errors. What am I suppose to rename/ include/replace etc.? Please forgive my lack of knowledge, I have absolutely no knowledge of C++ coding with UE4.

EDIT WITH MORE INFORMATION:

I know the basics of coding, not much about C++, since blueprints have been doing it for me fine until now.

The github link has both the .proceduralmeshcomponent.cpp and .proceduralmeshcomponent.h.

If you click 'view' in the top right of each you get to these two pages:

https://github.com/SRombauts/UE4ProceduralMesh/blob/728cd931d2f0bde7359168ffcc863bfbbaa8c718/Source/ProceduralMesh/ProceduralMeshComponent.cpp

https://github.com/SRombauts/UE4ProceduralMesh/blob/728cd931d2f0bde7359168ffcc863bfbbaa8c718/Source/ProceduralMesh/ProceduralMeshComponent.h

(That's the .h and .cpp I'm directly copying)

After doing Test>Debug>All tests I get a these errors:

Maybe I'm suppose to rename some stuff and delete it? Not sure...

alt text

alt text

Product Version: Not Selected
Tags:
a.png (72.2 kB)
b.png (66.9 kB)
more ▼

asked Mar 28 '15 at 11:02 PM in C++ Programming

avatar image

ShrewGlue
444 99 84 108

avatar image Azarus Mar 28 '15 at 11:15 PM

What errors do you get exactly? Which code are you copying? Also if you don't know c++ it is never too late to learn the basics at least :)

avatar image ShrewGlue Mar 28 '15 at 11:23 PM

Updated the main post with more info.

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

1 answer: sort voted first

First of all you can forget about the Error List tab it is used by intel sense which is completely messed up thanks fully to the precompiler headers. =(

Go look at the Output tab if you need errors and warning messages.

You only need these files:

  • ProceduralMeshComponent.h

  • ProceduralMeshComponent.cpp

Secondly:

Replace all occurrence of

 #include "ProceduralMesh.h"

to

 #include "TriKakei.h"

Also find your TriKakei.Build.cs file and make sure it looks like something this:

 using UnrealBuildTool;
 
 public class TriKakei : ModuleRules
 {
     public TriKakei(TargetInfo Target)
     {
         PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
         PublicDependencyModuleNames.AddRange(new string[] { "RHI", "RenderCore", "ShaderCore" });
 
         PrivateDependencyModuleNames.AddRange(new string[] { });
 
     }
 }


I think that's all. Now you should be able to compile your code without errors If not, let me know i update my post.

more ▼

answered Mar 28 '15 at 11:44 PM

avatar image

Azarus
1.9k 61 52 191

avatar image ShrewGlue Mar 29 '15 at 12:13 AM

I don't seem to have a

Proceduralmesh.h

At least when I ctrl + f I don't find any. I have multiple

ProceduralMeshComponent

And other functions involving ProceduralMesh such as

ClearProceduralMeshTriangles(); OR SetProceduralMeshTeriangle($SomeArgs)

This is what my build.cs looks like:

![alt text][1]

Thanks for all your help so far! I've up voted your answer :D

EDIT: So I went to Test>Debug>All Tests again, and I got a pop-up saying:

There were build errors. Would you like to continue and run tests from the last successful build?

Clicking 'no' and looking at my output tab it says:

The operation was canceled

Clicking 'yes' brings me to an empty output tab. (I assume no errors)? [1]: /storage/temp/36378-capture.png
capture.png (25.6 kB)
avatar image Azarus Mar 29 '15 at 12:18 AM

You need only those 2 files if you plan to work with blueprints. The other files are just c++ usage examples.

avatar image ShrewGlue Mar 29 '15 at 12:26 AM

It seems I'm unable to create this file!

alt text

The github page says:

Basic blueprints are created from the C++ Procedural Actor classes. This help demonstrating how they can be spawned manually in the level at construction time

Also, when I type in 'generatedMesh' which is the class name, nothing appears :\

alt text

What else could I have done wrong?

capture.png (54.1 kB)
capture2.png (18.8 kB)
avatar image ShrewGlue Mar 29 '15 at 12:19 AM

Alright. I'll test it out and get back to you/ mark your answer as correct if it works!

What would be the nodes I would use in blueprints to enable collision for this procedural mesh?

avatar image Azarus Mar 29 '15 at 12:30 AM

Create a new Actor and add the Procedural Mesh Component component to it

avatar image ShrewGlue Mar 29 '15 at 12:36 AM

Procedural Mesh compoennt is not showing up.

If I click 'new C++ Component' and then I can choose generatedMeshComponent, but that I believe is with blueprints.

avatar image Azarus Mar 29 '15 at 12:41 AM

here?

http://img.ctrlv.in/img/15/03/29/55174a1fe4e31.png

The assimp mesh is the same as the procedural mesh i just renamed it.

avatar image ShrewGlue Mar 29 '15 at 12:42 AM

Alright. I got it. Thanks.

How would I go about just simply creating a triangle that has collision with this?

avatar image Azarus Mar 29 '15 at 12:45 AM

Yes, Just create your triangles and the Set Procedural Mesh Triangles node will do the trick! ;)

avatar image ShrewGlue Mar 29 '15 at 12:47 AM

I don't have a custom Set procedural mesh triangles only a custom mesh triangles.

avatar image Azarus Mar 29 '15 at 01:06 AM

If you did everything right then you should have these new nodes avalaible: http://img.ctrlv.in/img/15/03/29/55174ff958107.png

avatar image ShrewGlue Mar 29 '15 at 01:12 AM

I don't seem to have it. This is a link to my .cpp .h and .cs files:

https://www.dropbox.com/sh/eckchjqi9ywz0q4/AADp-TMUUAYLx7_EJ83epSnXa?dl=0

You should be able to view them in-browser.

avatar image Azarus Mar 29 '15 at 01:21 AM

Oh, well delete those 2 GeneratedMeshComponent files.

And download these 2 files:

ProceduralMeshComponent.cpp

https://raw.githubusercontent.com/SRombauts/UE4ProceduralMesh/master/Source/ProceduralMesh/ProceduralMeshComponent.cpp

ProceduralMeshComponent.h

https://raw.githubusercontent.com/SRombauts/UE4ProceduralMesh/master/Source/ProceduralMesh/ProceduralMeshComponent.h

Copy them into your Sources folder.

Go to your .uproject file right click and select Generate Visual Studio Project files. (It will update the solution file with the new source files) http://img.ctrlv.in/img/15/03/29/5517533469b3d.png

Replace the

 #include "ProceduralMesh.h"

Inside your ProceduralMeshComponent.cpp file.

avatar image ShrewGlue Mar 29 '15 at 01:36 AM

To generate the .cpp and .h files I made a new which is a 'custommeshcomponent'

alt text

I then erased and replaced all the code with what you gave me.

The files were put in Source > Trikakei instead of just source.

It still does not appear though. Thanks so much for your help so far!!!

It is very much appreciated.

capture.png (38.8 kB)
avatar image Azarus Mar 29 '15 at 01:40 AM

It is not Custom Mesh. It is Procedural Mesh Component: http://img.ctrlv.in/img/15/03/29/5517581b495f5.png

avatar image ShrewGlue Mar 29 '15 at 01:53 AM

When I'm choosing a parent class which'll generate the .cpp and .h files, which one should I choose? alt text

capture.png (26.0 kB)
avatar image Azarus Mar 29 '15 at 01:56 AM

Use the AActor.

The Procedural Mesh is a component and you're not supposed to inherit from it i think?

You can use the blueprint system to create your custom meshes (Setup your triangles) and have collision on them.

avatar image ShrewGlue Mar 29 '15 at 02:38 AM

I still seem to have trouble. Here's a step-by-step of what I'm doing

  1. File>Add code to project

  2. Select Parent Class (I choose MeshComponent)

  3. Close out of the editor. Open up generated .cpp/.h files.

  4. Copy and paste what you gave me, making sure to replace the proceduralmesh.h with projectName.h

  5. Save, right click .uproject and generate visual studio project files

  6. Reopen UE4 editor. Create new blueprint class.

  7. Try to add the 'proceduralmeshcomponent' but does not appear.

avatar image Azarus Mar 29 '15 at 10:20 AM

Oh, now i see. Add an empty class or file to your code. The name must be ProceduralMeshComponent .

avatar image ShrewGlue Mar 29 '15 at 04:15 PM

Thanks SO much. You were incredibly helpful.

Thanks a bunch!

avatar image Azarus Mar 29 '15 at 05:08 PM

If my answers solved your issue please accept the answer. Thanks :)

avatar image Azarus Mar 29 '15 at 04:15 PM

I made a small video tutor just for you: https://www.youtube.com/watch?v=iFBSCox90Og&feature=youtu.be Started a fresh project added a new code to the project. Copied pasted the code and compiled it, without any issues.

avatar image ShrewGlue Mar 29 '15 at 09:14 PM

Thanks so much! Is it possible to have the collision on both side of a generated triangle? Right now it's only on one side. Is it possible to have it on both?

avatar image manuaganu Jun 23 '17 at 11:39 AM

After all this procedure can we load 3ds,Obj.. file to unreal engine at runtime?

(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