get Vertex X from Distort Map

This forum is currently in read-only mode.
From the Asset Store
A template which allows you to customise the controls of your game.
  • When I try to use the expression "get Vertex X" (or Y or Z) it always return zero.

    It seems to work fine with UV coordinates but not with the XYZ positions.

    This is yet another bug or what?

    I'm trying to make a better MeshEditor, but seems impossible to draw the vertices of loaded distorted meshes without knowing where they are.

  • Sprite.VertexX(col,row) returns the displacement of that point. If 0 is returned, that point is not displaced from it's normal position.

    For displacement in pixels:

    Sprite.VertexX(col,row)*Sprite.Width

    for absolute position (math is fun when you're tired):

    Sprite.Left+(col/Sprite.MeshCols+Sprite.VertexX(col,row))*Sprite.Width

    Here's an example that sets displacement of a point to what it is (AKA it does nothing):

    -> Sprite: Set relative displacement at (0, 1) to XYZ(Sprite.VertexX(0, 1)*Sprite.Width, Sprite.VertexY(0, 1)*Sprite.Height, Sprite.VertexZ(0, 1)) UV(0, 0) 100 % 
    [/code:2ijpn1qi]
    
    Hope some of that info helps.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the information ROJOhound, that clarify everything.

    Well, I must suggest changing the name of the expression to "Vertex Displacement X" then, since "Vertex X" logicaly suggest that the returned data would be maybe the relative vertex X position from the hotspot of the object, or relative vertex X position from the top left corner (since mesh points start 0 0 from there), or even the absolute position of the Vertex.

    From an usability point, it would make much more sense to have an expression that returned the positions rather than displacements, since positions are much more generic data than displacements.

    Displacements are derived data of two positions. But anyway....

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