No announcement yet.

"Selective" Collision on Static Mesh Actors? [SOLVED]

  • Filter
  • Time
  • Show
Clear All
new posts

    "Selective" Collision on Static Mesh Actors? [SOLVED]

    Well, I have most of my map completed (yay, go me lol), but I have an issue that's disrupting the functionality of some of the long-range vehicles' weapons.

    My tree meshes have very broad leaf planes (with a transparency-mapped material applied) and this prevents the Vehicle crosshairs from aligning properly with thier target and often hits far off from where you are aiming. Add to that the fact that the leaves are meant to be shot through, but the whole mesh is considered for weapon collisions, as opposed to just the collision model (which is what I am trying to get), and that stops a lot of otherwise great shots from hitting their marks.

    The problem is that the game will attempt to establish a line-of-sight trajectory to the target (enemy/terrain/mesh) but the leaves make the center circle on the crosshair vanish, presumably because despite the weapon "colliding" with the leaf there's no collision model associated with it there.

    Anyway, if anyone can give me a heads-up on any way other than one currently tested and working method (remove all collision from the tree itself and add a blocking volume that blocks all including weapons), it would save me a LOT of time that I could be using to do other tedious tasks.

    Thanks in advance.

    I would need a lot more information...
    Are these your own tree meshes? Are the trunks and leaves separate meshes? Were you using simplified collisions in them originally?


      Yes, these are my own tree meshes.

      The whole tree is one mesh as I was trying to avoid resizing the separate pieces in the editor while keeping them aligned and didn't think of it until later that as long as the rotation (center) point was the same, it wouldn't have mattered. So, now I am trying to find a way around having to add, move, scale, and rotate each set of leaves for each tree (unless there is such a tool that will automatically align a mesh to another mesh).

      Originally there was no collision. I decided to make my Collision Model from the builder brush, since I only like simple collision on most things (less getting "wedged" between meshes and getting stuck).


        Ok, if I followed that correctly...

        Since the trunk and leaves are one mesh, are you using one or two Materials?

        If you are using one Material, you will have to try setting bEnableCollision=false for the Material in the StaticMesh Editor. The problem with this is that all traces will be using the simplified collision only, so projectiles won't get per-poly on the trunk and things won't look right as the decals will be in the wrong location or non-existant.

        If you are using two Materials, you will have to try setting bEnableCollision=false in the StaticMesh Editor for just the leaf Material.
        This will remove collision of the leaf polys for most engine traces.

        If this doesn't work, the best design method for trees in UE2/3 is to use separate trunk and leaf meshes.

        Create a simplified collision for the trunk mesh that is close to the trunk shape (usually a 6 or 8 sided cylinder or similar), and set all UseSimpleXCollision to true.
        But for the leaf mesh you keep its origin proper to the trunk so that it is easier to place in the editor and resize/rotate with the trunk properly.
        Then give the leaf mesh a small 8x8x8 or 16x16x16 cube collision down at the origin. Set all UseSimpleXCollision to true for the leaf mesh also.
        This cube collision at the origin will be embedded into the trunk so it won't affect anything in-game since the collision is hidden below in the trunk bottom.


          So you have a bunch of static meshes that are identical except in location/rotation/scale, and you would rather they were made of two static meshes, one with collision and one without? If so, then there might be a relatively quick but convoluted way of doing it...

          There is a commandlet that can replace every actor of a particular class in a map with a different class. Since you only want to replace particular static meshes not all of them, you would have to copy the trees into an empty map, then replace them all with a new class that has two StaticMeshComponents, then copy them back into the original map (deleting the originals first). The new actors would keep the properties of the old ones i.e rotation etc. (at least they should - I've never actually tried that commandlet so I don't know if it really works).

          There is no class with two StaticMeshComponents like that though, so it would require some scripting. I don't know if you know how to do that, but I would be happy to help, since it would only take a few minutes.


            No need to use commandlets or scripting.

            Assuming that the replacement meshes had the identical origin, it would be easier to simply select one tree mesh, right-click and Select Matching StaticMeshes (this class), replace the StaticMesh component with the one you want (eg. the trunk), then do a Duplicate which creates a second copy of every selected mesh and offsets them by 16/16 (and deselects the previous selection), then simply change the duplicated mesh (eg. the leaf), and move them back over 16/16.


              OMG, I'm a dork, but I figured out the easiest way to do it.

              For those who ever run into this issue:

              1) In your 3D Modelling Program, open your mesh and delete (or Cut) the Trunk of the tree (or whatever you don't want collision on) from it. In my Case, My leaves were in a totally different Layer in Blender so selecting the trunk individually was easy.

              2) Since you have the leaves left over, save (and/or export) it as a seperate mesh.

              3) Open the original model again and delete out the Leaves, as the collision model will be retained when you import the mesh over the old one.

              4) Save and export the model under the original model's name so that the naked trunk will have the collision assigned to it.

              5) Import the meshes into the Generic Browser. This will replace the matching trees with the new, naked ones.

              6) Select all instances of the mesh that needs leaves, yup the trunks. Now Alt+Drag to duplicate the meshes and keep track of how far you are dragging them on the bottom of the viewport.

              7) Move the meshes back the exact distance so that they overlap the duplicates.

              8) While the meshes are still selected, **** VERY IMPORTANT YOU DON'T ACCIDENTALLY DE-SELECT by clicking something****, go to "View>Actor Properties."

              9) Under "Static Mesh>Static Mesh Component" there will be an Option that says "Static Mesh" or "Mesh Info" or similar. Select the Leaf Model in the Generic Browser and assign it to this field and all selected trunks will turn to leaves.

              10) Turn off collision for the leaves, Build Lighting, Save, Backup, and pat yourself on the back 'cuz you're done.

              This whole process took me about 10 minutes to fix every tree in my map.

              Thanks for the replies guys.

              EDIT: LOL DGUnreal, beat me to it by but a few minutes.


                Originally posted by ShadeMistress View Post
                LOL DGUnreal, beat me to it by but a few minutes.

                I swap out StaticMeshes via the StaticMeshComponent property all of the time in the editor.

                It keeps the map cleaner and the order of inserted items and their Object names cleaner.

                I never delete brushes or StaticMeshes when I am constructing a map. As I make changes I just drag things out of the way if I don't like it or if I make layout changes. Then later I just re-use them instead of inserting new ones. Just vertex edit any spare brushes or change them from CSG Add to Subtract as required, and for StaticMeshes just change the StaticMeshComponent.StaticMesh property to the new mesh you want and adjust any other properties like Scale and Rotation and Lightmap.
                I also use this to try out various map designs as well, such as selecting all column meshes in a room and changing their StaticMesh property to other package column variations to see what looks best. Quick and easy.

                The only time I delete anything is when I am done with the map and there is anything left over, which doesn't usually happen.