No announcement yet.

Dynamically stretch a static mesh... impossible?

  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamically stretch a static mesh... impossible?

    Is there any way for the engine to dynamically stretch and orient a mesh?

    For instance: when the player presses space bar the engine would use their current location as a starting point and then create a cylinder that is stretched on one axis only to another point in the world?

    I wouldn't care if the material is stretched or not.

    If anyone could point me in the right direction in either Kismet or Unreal Script I would greatly appreciate it. Thanks!

    I'm using UDK May 2011, FYI

    Does it need collision? If not you could use a particle or stretch the mesh with vertex shader.

    But anyway, here's a test map that demonstrates a couple of things for you when you walk into the trigger:

    (link removed)

    1. Gets the pawn and the rotation of it's weapon hand.
    2. Sets the rotation of the cylinder interpactor.
    3. Uses matinee to stretch the cylinder using Drawscale3D.


      Thanks a ton, I'll look into it and get back to ya!


        So I played with it and I see how it works I think. I was hoping I could use Matinee in conjunction with dynamically assigned variables so that I could actively create a bridge in the game when two switches are activated.

        The catch is that I want the switches to be placeable by the player in the world.

        Here is the part that I've already figured out:
        The engine to determines the location of the switches (get object location) and then places the bridge (InterpActor Cube) between them (break into vectors>average the locations>set location). Then it determines the distance between the two switches (get distance between objects) and outputs that into a float var.

        The parts that I need help with are:
        1. Figure out how to rotate the bridge so that it creates a straight bridge between two points. I believe that this will come down to setting the rotational vector based upon the locations of the two switches.

        2. How to feed float variables into matinee so that I can use them for the keyframe values on key1 so that when we play the matinee the cube is stretched and rotated to meet both switch objects.

        You may have already answered this in the level that you sent me but I didn't see how. Thanks for taking the time to help. If there is a tutorial that you know of that will go through the process then I'd rather not waste your time. Thanks again!


          So... I guess it is impossible?


            does it have to be precise? I mean does it have to be really as long as the distance between the switches down to the last mm? If not, why dont you make a tileable staticmesh that when put together forms a bridge? If the width of the bridge section staticmesh is known then all you have to do is measure the distance between switches than divide that with the known width of the mesh then place as many as there are whole numbers in the division.


              I guess it doesn't really need to be perfect but it seems like it would be a common request to be able to manipulate the key points on the matinee curve via assigned variables. I'll use your idea for now, thanks Hunharibo. If anyone else can think of a better solution I'm all ears.


                Kismet unfortunately lacks the math/trig functions to do enough of this kind of math, and yes dynamic matinee key values would be very useful (along with improved get/set property actions)... however there is another way to achieve what you're after...


                There are two small spheres there (the two points the player places to make the bridge between).
                The scaled cube in the middle is the "bridge" (I make sure the pivot is at the start of the bridge).
                First, it relocates the bridge to the first point, then uses matinee to "look" the bridge towards the second point - that takes care of the rotation.
                Second, it calculates the distance between the two points, then stretches the bridge drawscaleX with matinee until I tell it to stop (the point where it stops is defined by the distance between the two points).

                You'll probably need to adjust things a bit, but I think it should work for you, at least for prototyping purposes.