Skip to Main Content
Construct 3 suggestions 21H2 - ARCHIVED

This suggestions platform is now closed and will be shut down on March 1st 2024.

Please ensure any content you care about is backed up before that date.

Feature requests are now handled on GitHub here: https://github.com/Scirra/Construct-feature-requests

18 VOTE
Categories 3D
Created by Tacker Tacker
Created on Apr 5, 2022

MeshPointX/Y/ZAt(column, row) expression

I need to get the position of mesh points.

Here is what I am trying to do:

I want to create sprites with meshes, model them into certain shapes in the editor and apply some slight random offsets to the mesh points in code to provide some random variation for a more interesting look.

It is similar to what the tank movement example does with the ground sprite, the difference is that I want to do it with a mesh that has already been shaped in the editor beforehand.

Problem:

The problem is that there is no way to add an offset to a mesh point since you can't ADD to mesh points you can only SET them.

You also can't get the mesh points position in space via expressions to be able to add to them yourself.

Solution:

My suggestion is to add an expression similar to the "Sprite.PolyPointX/YAt(index)" expression that already exists to get the collision polygon points but for the points of a mesh, it could be called "MeshPointX/Y/ZAt(column, row)" to keep it consistent.

For my particular use case it would also be possible to solve it by adding an "Add to mesh point" action in addition to the "Set mesh point" action, but the expression to get the points positions is preferred because it is much more flexible. For example if you would use the "Add to mesh point" action a couple times to move a point and later want to revert it you would have to save each offset you have applied in order to do that.

Workaround:

There is a possible workaround for all this, you could add an Array to the sprite and input every single X,Y,Z coordinate of every point in the mesh by hand, but this is incredibly tedious and error prone, and it would be on top of the already very tedious process of creating meshes in the editor.

  • Attach files
  • N R
    Reply
    |
    Sep 9, 2022

    To add to this: while we can get the points from the JSON this feels unnecessarily complex given the ability to get other object attributes with a simple expression.

  • N R
    Reply
    |
    Sep 9, 2022

    Was just looking for the ability to get meshpoint x/y/z. Surprised this doesn't exist already. Take my upvotes!

  • +11