Announcement

Collapse
No announcement yet.

How to create a simple 3 Vert Triangle in C++ only?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to create a simple 3 Vert Triangle in C++ only?

    I am looking for a simple tutorial on how to create a simple Triangle consisting of 3 vertices in c++ without any fancy additions like blueprint accessibility.

    I just want to spawn a triangle by giving 3 hardcoded Vector points, adding the corresponding UV Coordinates and a material / texture. Voila.


    I already checked out this Article: UE4 Wiki: Procedural_Mesh_Generation

    But that just throws a finished and complex wall of code at me without any further explanation for starters. Besides the fact it beeing outdated in 4.8.

    #2
    That is the only real way to do it I'm afraid, you'll just have to grin and bear it through the code (I agree that it could use far more informative comments).

    ProceduralMeshComponent is the best thing to use for this since it handles a lot of the callbacks into PhysX and the Rendering module that you would otherwise have to write in yourself.

    Comment


      #3
      So, i need more than 500 lines of undocumented code to create a simple triangle in UE4? i guess ease of use has just been redefined by Epic

      Any infos about how to use the newly added ProceduralMeshComponent?

      Comment


        #4
        Well you'll have to read through it and figure out what parts you need, but I imagine that's roughly what you need to get started. Most of it involves overriding existing functions in Procedural Mesh Component.

        All of the functions in there seem to be accessible to Blueprint, so perhaps try doing this in Blueprint before tackling it in C++? Can't be of much more help I'm afraid since I haven't used these before, but a few folks around here have and usually post source code.

        Comment


          #5
          Thanks for your help.

          Iam typing every line by hand, looking it up in the ue4 documentary and learning what it actually does instead of just copy+paste and use the blueprint.
          Progress is slow but constant, once i finished the thing i may create a simple tutorial for starters.

          Comment


            #6
            Well Unreal recently added the Procedural Mesh component. I'm pretty sure that does what you're looking for. You could have an actor which a UProceduralMeshComponent* PMComp and work from there.
            I've never tried it though in code since I could barely do anything with the blueprint version, but perhaps you'll figure it out.

            Comment

            Working...
            X