Mesh - some tips and feedback

  • Hi all!

    Today I have been testing the new mesh deformation in beta r219. Although the included example projects are fancy and impressive, they might be a bit complicated for beginners, so I wanted to share some simpler examples, that also have practical applications in a game. The examples include:

    - Crop a sprite

    - Crop a texture (similar to above but keeping the original size of the instance)

    - Shear/skew a sprite

    - Flip a sprite

    - Flip a texture (similar to above but only flips the texture not the instance itself)

    - Scroll a texture within a sprite

    Each example shows how to do it with both relative and absolute modes.

    I'll put each example in a separate post because sometimes I have issues uploading multiple images.

  • This example shows how to crop a sprite in half horizontally:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This example shows how to crop the texture in half horizontally but maintain the size of the sprite instance:

  • This example shows how to shear/skew the top edge of the sprite by 50%:

  • This example shows how to flip a sprite (including the texture) horizontally:

  • This example shows how to flip only the texture horizontally without flipping the sprite instance:

    FEEDBACK: This is a bit weird with relative mode - the last two lines in relative mode should technically be -1, but I had to use -1.1 because -1 means use original value. The engine seems to bounds check the -1.1 to -1 anyway so it works, but it's not intuitive. Ashley maybe you could use another value instead of -1 to represent the original value? Or use < -1 instead of == -1?

  • My last example is scrolling the texture within the sprite, which is a bit harder to explain, for example imagine you have a conveyor belt, instead of animating the conveyor belt moving, you can scroll a seamless texture to make it look like the conveyor belt is moving. The example below shows a texture that has been scrolled horizontally 30% to the right.

    FEEDBACK: This was a bit fiddly, especially with relative mode, so I would suggest using absolute mode in this case. You will note I had to increase the number of mesh points and collapse the middle points together to the same position. This would be much simpler if it implemented UV wrapping - I'm not sure of the OpenGL terminology - but that's what I would call it. Then I could more simply use a 2x2 mesh, and set column/row (0,0) to texture (0.3,0), (0,1) to (0.3,1), (1,0) to (1.3,0), and (1,1) to (1.3,1).

  • Sorry here is the screenshot for scrolling texture:

  • Last of all, not so much feedback as a begging pleading wish, let mesh points have z-elevation, you would then have instant awesome psuedo-3D to easily have top down buildings like the original GTA, or dungeon crawls like Eye of the Beholder.

  • > FEEDBACK: This is a bit weird with relative mode - the last two lines in relative mode should technically be -1, but I had to use -1.1 because -1 means use original value. The engine seems to bounds check the -1.1 to -1 anyway so it works, but it's not intuitive. Ashley maybe you could use another value instead of -1 to represent the original value? Or use < -1 instead of == -1?

    You can't set the texture co-ordinates outside the range [0, 1], because that would show content outside the object's image. So any texture co-ordinates you set will be clamped to this range. -1 is not in that range, so is safe to use as a special value for "don't change".

  • Ashley if you look at the example for flipping the texture, if you are using relative mode, setting column/row to (1,0) to texture coordinate (-1,0), is effectively setting texture coordinate to (0,0), which should be valid.

  • Oh right, I didn't realise about that. It would be best to file an issue otherwise this point will be lost on the forum.

  • "let mesh points have z-elevation, you would then have instant awesome psuedo-3D to easily have top down buildings like the original GTA, or dungeon crawls like Eye of the Beholder."

    This would be amazing, Mesh seems like it was made for the Z elevation feature!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)