Announcement

Collapse
No announcement yet.

Creating custom Collision Hull from Builder Brush

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

    Creating custom Collision Hull from Builder Brush

    Heya, I was asked by someone to make this little tutorial, so why not share it with everyone while I am at it.


    This will focus mainly on creating the collision hull with the red builder brush. The other approaches (K-DOP and creating in an external modeling program) can be seen on the UDN.


    This is the collision as it was computed by the UDK-internal Auto Convex Collision in the StaticMeshViewer:



    In this case it used a lot more polygons than would have been necessary and it's almost worse than using the mesh itself for the collision.

    So it's best to do it yourself after all.


    The first thing we do is creating a copy of our mesh and move it up high so that there is nothing that could disturb us. You should especially pay attention to not having any BSP touching the mesh or it's proximity:




    Now we should make sure that our mesh lines up well with the grid. You may want to lower your grid resolution for dragging and rotating it around. If your mesh is off the grid already, you can easily delete the decimals in the Movement property group and also clear the rotation if necessary:




    Now take your red builder brush and move it in place so that it encloses the first convex section of your StaticMesh very tightly.




    You can drag out the vertices in Geometry Mode to match the slopes of your mesh. Try to stay convex with the shape of your brush. In this example I finished the bottom part of the mesh now, which is convex (means that you can reach any corner from any other corner without leaving the brush).




    Now press the CSG_Add button to create BSP from your brush. This is only temporary.


    #2
    Now we have "saved" our first part of the collision hull and can continue with the next one, in my case the top. Move the builder brush again in position..




    .. and add it again as CSG.




    Do this until you have convex shapes for all parts of your StaticMesh.

    Then get your builder brush into a shape that is big enough to enclose the whole construction, but no other BSP (that's why we moved our mesh away from BSP).




    Now hit the Intersect button , which will turn your red builder brush into a combination of all the enclosed additive brushes.




    Finally select your StaticMesh that you just built around, right-click on it and choose Set Collision from Builder Brush (Save Brush as Collision in earlier engine builds).




    The result looks much better than the computed one and will get us some more FPS in our game.
    You can now delete the additive brushes that we used to create this.





    In earlier engine builds (and still in the current when exporting external collision) it was recommended to leave a little, almost unnoticeable gap between two convex parts of the collision. That is in order to help the engine to split up the collision hull into convex parts, which can sometimes go pretty wrong and push up the number of "primitives" of that mesh. A high number of primitives is especially bad if the mesh is used for interpolation and can have serious impact on the frame rate then.
    But the UDK seems to be clever here and splits the collision hull up properly, even though I didn't leave gap between the two parts:




    If you get more primitives than necessary, however, you may want to leave that small gap there.


    We are done, hope it helps some guys out there.
    This is a job that can be done by level designers, no need to bother your modelers with additional work in the initial phase of your project where the LDs have to wait for content from the modelers anyway.

    Had to split it up into two posts because only 9 pictures are allowed per post.

    Comment


      #3
      Why not save all that time and just add a blocking volume around your geo?

      Comment


        #4
        Because you re-use the StaticMesh in other maps, rotate it, scale it, and so on. The collision hull is always relative to the mesh, the BlockingVolume would need to be adjusted every time by hand.

        And many Volumes can quickly blur the overview in the map and it's easier to simply show/hide the whole collision hulls with the 'c'-button instead of using Groups or Show/Hide Actor functionality.

        To summarize: it's just how it should be done.

        Comment


          #5
          Thanks. That looks much better

          Comment


            #6
            Appreciate the post Crusha, woot.

            Comment


              #7
              thanks

              Comment


                #8
                Thanks, so we don' t need to create all the stuff in a 3D softwar, that' s cool !!

                Edit : When we walk on these builds, what is the sound that you ear, if i' m right, you need to customize this property, if the material is metal, is the metal soundcue that you ear ??

                Comment


                  #9
                  Yeah, you set a PhysicalMaterial for the sound (and optional also for the effects that appear when you shoot it with your weapon, if you code such functionality into the weapon). Don't know if it's somewhere in the StaticMeshComponent properties or if it takes the one specified in the Material (since that one can also use a mask for PhysMats).

                  EDIT: Though I think using the Material wouldn't make that much sense since you don't always touch the actual Material when walking on the collision hull. So I think you set it globally for the whole mesh.

                  Comment


                    #10
                    Ok, nice, I will take a look at this .

                    Comment


                      #11
                      Makes sense. I've done collision for so long I didn't immediately consider someone not building collision for something in the first place.

                      Comment


                        #12
                        Beautiful tut!

                        Comment


                          #13
                          Originally posted by Crusha K. Rool View Post
                          Yeah, you set a PhysicalMaterial for the sound (and optional also for the effects that appear when you shoot it with your weapon, if you code such functionality into the weapon). Don't know if it's somewhere in the StaticMeshComponent properties or if it takes the one specified in the Material (since that one can also use a mask for PhysMats).

                          EDIT: Though I think using the Material wouldn't make that much sense since you don't always touch the actual Material when walking on the collision hull. So I think you set it globally for the whole mesh.
                          I've experimented with this a bit and it seems that if a physics asset has been asigned to the material, it'll use that as the default for anything that the material is applied to. If you then set a physics asset in the mesh itself, that will overide the material setting.

                          I didn't confirm that anywhere, but that's how it appears to work for me.

                          Comment


                            #14
                            @Crusha K. Rool
                            i can't see the pictures of your post! did you put this tut in another site too?
                            can you give a link to the source or something?
                            thanx

                            Comment


                              #15
                              Pictures load fine.

                              Comment

                              Working...
                              X