Announcement

Collapse
No announcement yet.

I want a "static" mesh that can change to a different static mesh through code.

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

    I want a "static" mesh that can change to a different static mesh through code.

    What I would like to do is damage a wall, and when the wall is destroyed, replace it with another mesh. What's the best way to go about doing that? It doesn't have to actually take damage like destructible mesh. Thanks for your help!
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    #2
    I have this code which I remember working

    Code:
    Begin Object Class=StaticMeshComponent Name=defmainmesh
    StaticMesh=StaticMesh'test.testmesh'
    Scale=3.0;
    CollideActors=false
    BlockActors=false
    End Object
    Components.Add(defmainmesh)
    mainmesh = defmainmesh;
    
    
    function Config(StaticMesh meshname)
    {
    mainmesh.SetStaticMesh(meshname);
    }
    Another thing I do when dealing with more complex stuff, is to have 2 objects at the same location and use SetHidden to show/hide either one or the other, that's when the objects have very complex behaviors that I can't just change by running one line of code.

    Comment


      #3
      I have done fractured meshes on my game, and for me it works perfectly.

      You don't need in example that the player actually shoots, hits the wall, just place a RB_RadialImpulseActor to the map and trigger it via kismet, and it will cause the hit and destroy the wall.

      Also you can add a particle effect in the front of the wall and trigger it to simulate an explosion.

      If you need that the player can pass through the destroyed wall after the "explosion", you need to place a blocking volume behind the fractured mesh (because it does not block collision) and whenever the wall is destroyed by the RadialImpulseActor you destroy the blocking volume. I have done all this in kismet.

      Good luck

      Comment


        #4
        Thanks ciox and udkultimate. I'll give both of those a try and see which works for me.
        Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

        Comment


          #5
          For using RadialImpulseActor just take a look on the UDK ExampleMap.udk, that one which is in a kind of hangar, where you get an elevator then place a bomb on wall to open the passage to a small room where you fight a boss (bot).

          Is from that map I got the fracture mesh idea:

          Click image for larger version

Name:	examplemap.jpg
Views:	1
Size:	394.3 KB
ID:	1624266

          Comment

          Working...
          X