Texture Tweening Using Only Textue2D(Sprites) RRS feed

  • Question

  • This all refers to 2D objects.

    I have 2 rigid bodies connected by a hinge joint in my physics engine.

    These two bodies represent a leg. The leg, physically, can bend as you would expect.

    I'm trying to figure out how to texture this bending leg so that the leg sprite(s) looks like one continuous image as it bends.  (Texturing the leg parts individually is not an issue)

    I belive this is called "tweening".  Is this possible using only Texture2D objects? Or am I going to have to build a custom sprite/quad to handle this?


    Friday, February 2, 2007 2:49 PM


  • One way to do this would be to have one section of the leg overlap the other slightly. For example, one texture is a thigh and the other is knee to foot - the hinge is placed at the centre of the knee and the knee to foot texture is rendered over the top of the thigh. If the textures are carefully drawn then it should look ok.

    This flash toy probably explains it better.

    If you actually want a single image of a leg to bend then you this could be done using a skinning vertex shader but that will be a bit more involved.

    Friday, February 2, 2007 3:29 PM