Announcement

Collapse
No announcement yet.

Custom class for foliage

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

    Custom class for foliage

    I'd like to add collision to some of my foliage meshes, such that I can handle touch/untouch events for them.

    Does anyone know how this can be done?

    On a side note, it seems the foliage collision settings only handle blocking:

    I'd like to only collide and not block. Is this even possible.

    Thanks in advance for any tips. Cheers

    #2
    pretty sure they only added the option for a custom foliage class later in UE4 (wasn't even there in UE4 4.0).
    foliage in UDK is pretty much a black box anyway, in terms of accessing/using instance stuff from code
    Follow me on Twitter!
    Developer of Elium - Prison Escape
    Local Image-Based Lighting for UE4

    Comment


      #3
      Maybe go reverse and make the player pawn search for foliage actors around him?

      Comment


        #4
        ciox How would you go about searching for foliage? Using something like
        Code:
        foreach VisibleActors()
        doesn't seem to ever return foliage actors.

        Comment


          #5
          as I said, foliage is a black box inaccessible from code in UDK

          if you absolutely require this you might need to handle your vegetation differently.
          for example there was some snippet some time ago that would spawn and de-spawn mesh actors around the player as you'd move. but of course it's not as optimized as using foliage so the rendering distance would be much inferior
          Follow me on Twitter!
          Developer of Elium - Prison Escape
          Local Image-Based Lighting for UE4

          Comment


            #6
            Yeah i think the only way i can think of doing this is either place static mesh volumes in areas of dense foliage, and use touch events on those, or simply use static meshes instead of foliage. Think i'll postpone any work in this area for now. Thanks for the responses.

            Comment


              #7
              You can access to each cluster looking in the foliage actor InstancedStaticMeshComponents.Length, and then find each mesh location with MatrixGetOrigin(PerInstanceSMData[index].Transform), and compare with the player location to see if they are colliding.

              But probably it will be too slow. I use it to hide/unhide clusters but only a few of them in every tick.
              Provisional blog: http://cobaltudk.blogspot.com.es/
              Videos: https://www.youtube.com/user/cobaltudk
              Facebook: https://www.facebook.com/babylonprojectgame/

              Comment


                #8
                Are you looking at player collision or vehicle collision on foliage actors?

                if your looking at player collision like not walking thru certain foliages. In your static meshes. in your games upk files open that particular model and uncheck Use Simple Box collision this will cause you to not be able to walk thru the model if placed in map by itself. also uncheck Use Simple Rigid body Collision. This as a stand alone static mesh will cause vehicle collision to work.


                With those unchecked and added as a foliage actor model.
                If you put them into the foliage actor with both those uncheck the Use Simple Rigid body Collision. Will now work as player collision to not be able to walk thru that model, but for vehicles it seems there is no collision with the foliage actor.

                Hope this helps, hope I made sense above. This is what we found when testing for vehicle foliage actor collision,

                Comment

                Working...
                X