Help with ensign

Blitz3D Forums/Blitz3D Programming/Help with ensign

Yue(Posted 2012) [#1]



Hello, I would like someone to help me with the following, I implmentando physical fabric system, but the problem is that not what the number of each vertex, for example to engage the banner from the vertex 0, I would like someone give an idea about it.

Greetings.

Last edited 2012


Yue(Posted 2012) [#2]


I managed to identify the vertices to hook the flag to a pole, but this is very confusing because I thought that the vertex 23 corresponds the vertex 0 ... this is very confusing and I had to do it manually.


Kryzon(Posted 2012) [#3]
What are you using, Blender3D, FragMotion?
You should make a script to build a mesh clone of the flag based on vertex-positions: starting with the ones further to the top, so they have the first indicies.

This would make that pole-attachment side have vertices 0,1,2,3,4... like you want, and the tip having the exact last index.

That's what I'd do, apart from rebuilding the flag manually, vert by vert.


Yue(Posted 2012) [#4]
Hello, I'm working with Fragmotion, still do not understand what the scripts that I mention, appreciate to give me more information.

Greetings.




Yasha(Posted 2012) [#5]
Vertex numbers are based on the order in which the vertices are added to the surface.

If you load a mesh using the builtin LoadMesh command, you don't control the vertex additions yourself and therefore don't know what order they're added in; which in turn means you don't know what the index for any given vertex will be (it's probably consistent from load to load, but a. nothing says it has to be, and b. you don't necessarily know in what order Fragmotion exported the vertices, which may not be related to what you did in the editing window).

Kryzon is suggesting that you write a code snippet in B3D that reads the vertices from your loaded mesh; sorts them using their position data into the order you want (i.e. starting from the corner and counting away from it); and then builds a new mesh adding those vertices in the corrected order. You'd then get rid of the original, and use this cloned mesh which has the vertex indices that you want.

For small meshes like that, this is probably fast enough to add as part of your game's resource loader, so you don't need to worry about saving the adjusted mesh (and then being at the mercy of the builtin loader again).

Last edited 2012