Need help converting model to triangles!

About Monkey 2 Forums Monkey 2 Programming Help Need help converting model to triangles!

This topic contains 3 replies, has 2 voices, and was last updated by  DruggedBunny 1 month, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14608

    DruggedBunny
    Participant

    I’m really struggling with visualising the whole mesh/vertex/index/triangle thing!

    It doesn’t help that I don’t really understand what the indices are, and how they relate to triangles…

    So far I have a ModelFromTriangle:Model function (at the top) that takes a model and attempts to return a single triangle from the model’s mesh, but I think even that may be down to poor understanding.

    It produces what looks like a cube from a distance (the original gets hidden), but as you approach (A/Z, cursors) it becomes clear I’ve got the wrong end of the stick completely. Moving the model to z=10 even adds a weird black triangle here. Enable the sphere version for an even more bizarre result!

    I basically want to see how turning a model into triangles, and then turning those into physics bodies, goes — probably painfully slowly, but ought to look really cool, and worth a try (for my Bust! demo)…

    Not taking into account materials or repositioning to match the original at this stage, just trying to recreate the right triangles from the model using a hard-coded material for now…

    [/crayon]
    #14613

    Simon Armstrong
    Participant

    You need to get the source vertices via their index:

    #14614

    DruggedBunny
    Participant

    Ahhhh… thanks, Simon, that’s awesome, will try take it in, but I can at least get to work now! Thanks again.

    #14650

    DruggedBunny
    Participant

    Getting somewhere with this, with a lot of hand-waving…

    Shatter!

    Source

    Messy and still needs a lot of work, eg. triangles’ physics bodies are boxes so they don’t settle right (think I will try build rects from them instead), but at least the ball’s disintegration looks sort-of OK. Ideally it would disintegrate as each triangle intersects the ground, instead of the instant the ball touches the ground, but it’s basically doing what I was hoping for.

    The triangles seem to disappear initially, but I think it’s because they turn edge-on, being infinitely thin.

    Bit slow on WebGL, unsurprisingly.

    In real life, triangles would be replaced with pre-generated model chunks.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.