Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Loading .obj-assets with a deafult project

edited October 2017 in Codea Craft Posts: 105

I tried this:

    craft=require("craft")
    Model=craft.model("CastleKit:siegeRam")
    M=mesh()
    M.vertices=Model.positions

in my setup, assigned a white-color-writing shader to it and used M:draw in my draw-function. But it seems that not every triangle in the model
is rendered to the screen, looks like those triangles with a different color or material is not copied/rendered.

Any ideas?

Comments

  • em2em2
    Posts: 194

    Possibly because the vertices are not triangulated? Maybe craft uses a different vertex system. Try using default craft draw functions.

  • Posts: 105

    @em2 Will experiment a bit! @Simeon Do you know? Thank you for the update btw!!

  • JohnJohn Admin Mod
    Posts: 622

    @MMGames
    There are two things going on here. The mesh class does not support triangle indices and so every 3 vertices is a triangle. The model class supports triangle indices so every 3 indices is a triangle (each one refers to a given vertex).
    Another thing is that models loaded from an obj file can have a number of submesh objects inside them to support multiple materials per model. By default you can only access the first submesh. I plan to add some methods to access these submeshes but for now you can't.

Sign In or Register to comment.