Trying to learn how to add 3D model to game

I have created a basic cube model in Blender and exported the Collada dae file and imported that into my project. I have setup the box material similarly to the MeshTest example project posted here: Mesh Component

I configured my model as such:

However when I add the model to a collection in my game I see the error:

WARNING:GRAPHICS: 0(31) : error C1068: too much data in type constructor

I’m not sure what this means or how to fix it. Anyone seen this before?

Hmm I think I figured that out. I was trying to create a vec4 using 4 arguments instead of 2 but now I see:

dmGraphics::OpenGLSetConstantV4(1750): gl error 1282: invalid operation

Looking at the defold source code it is happening in the OpenGLSetDepthStencilRenderBuffer function. However, I have render.disable_state(render.STATE_STENCIL_TEST) set previously when rendering my sprites in the render code.

EDIT: I am able to render an object w/ just the mesh file in the game without issue. However, because it’s not a model I am unable to scale it using the vector shader. Is there some reason I must use a Collada mesh instead of just supplying the mesh created in Defold? Also, how am I meant to create a buffer? I can look at an example of a box and the name/type/count fields make sense. However, after there’s simply a large number of “data” float values. Maybe I’m misusing the buffer and treating it like a model. Is this more of a bounding box for where vertices in the Collada dae file can exist within?

EDIT2: I now have a mesh rendering properly in the game! I am not using the Model object instead just creating a mesh and transforming the buffer positions in the script. I have a few questions however if anyone has the time/knowledge: I would like to toggle visibility of an entire mesh object dependent on the player position. Also, I would like to learn how to create a buffer file. In the example the monkey head for instance is represented by the data in the suzanne.buffer file. However, I don’t see any tools for creating this type of file or how to interpret it. If anyone knows of some resources please guide me towards them :slight_smile:

Thanks if anyone has the time to read this. Hoping to get some 3D objects into my game soon! :slight_smile:

1 Like

Some of that mesh stuff is meant for making / modifying meshes dynamically. Not just using .dae files in your scenes.

I would like to toggle visibility of an entire mesh object dependent on the player position.

You should be able to send disable / enable messages to the component?

In the example the monkey head for instance is represented by the data in the suzanne.buffer file. However, I don’t see any tools for creating this type of file or how to interpret it.

defold_mesh.py in the zip in this post should help you Mesh Component

1 Like

Thank you! Yes sending the disable/enable messages works properly. I’ll have a look at adding the defold_mesh.py addon into my Blender install.