Page 1 of 1

[Solved] Is it possible to use nodeboxes in entities

PostPosted: Wed Jan 03, 2018 14:39
by Sires
And dats my question.
I tried doing it by setting a nodebox parameter but I dunno, the nodebox seems like "So buggy like depending in the direction you look you may see some sides or not or you see a hollow cube instead of an solid one"

Edit: I want to know where do I put the nodebox in the entity defenition to make it use a nodebox as the model

Edit2: I guess I found it and it's a complete code kludge(uuh, *Insert english is not my native language response here*), I saw that ppl register a node with the nodebox you want and then register an entity with visual wielditem of that block, that made me cry while I was reading it T-T Anyway, a bit offtopic but have anyone ever requested the feature of the "nodebox" visual?

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 17:50
by Krock

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 17:54
by Sires
I read this code but it's too confusing, I didn't get it

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 17:54
by Sires
Can you make me a "sample" code plz? so I can understand

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 17:55
by Sires
But yeah, basicly I just want to be able to use nodeboxes like in this mod

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 18:08
by Krock
First of all, please consider editing your posts instead of creating a new one. This is a forum, not a chat.
Here some help if you can't find the edit button:
Image

I couldn't find an API reference there, so I suggest looking at the already existing mods, like this lion. If you create a new mod, ensure you add a "depends.txt" file with the line "nmobs" inside, so you can use the API functions.
For further questions or help, try asking in the mod thread.

Re: Hello, is it possible to use nodeboxes asmodels for enti

PostPosted: Wed Jan 03, 2018 18:41
by Sires
Ok...

Edit: But anyways this still uses the api, look first post to see more details of my question :P
Second edit: solved -_-

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Wed Jan 03, 2018 21:57
by stu
Sires wrote:And dats my question.


It is possible in a round-about kinda way. First you need to register a regular node for your nodebox then create an entity with the `wielditem` visual type and use the item name-string in the `textures` table.

example:
Code: Select all
minetest.register_entity("your_mod_name:nodebox_entity", {
   visual = "wielditem",
   textures = {"your_mod_name:nodebox_node"},
})

You may also need to adjust the scale, I don't remember :)

Note: some moderator might correct the title of this issue, it seems to have become somehow self-depleting.

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Thu Jan 04, 2018 01:35
by Sires
stu wrote:
Sires wrote:And dats my question.


It is possible in a round-about kinda way. First you need to register a regular node for your nodebox then create an entity with the `wielditem` visual type and use the item name-string in the `textures` table.

example:
Code: Select all
minetest.register_entity("your_mod_name:nodebox_entity", {
   visual = "wielditem",
   textures = {"your_mod_name:nodebox_node"},
})

You may also need to adjust the scale, I don't remember :)

Note: some moderator might correct the title of this issue, it seems to have become somehow self-depleting.


The solved I guess because I found it myself, I wrote your solution in the Edit2, but I think it's too hacky, but anyways work

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Thu Jan 04, 2018 18:09
by stu
Sires wrote:The solved I guess because I found it myself, I wrote your solution in the Edit2, but I think it's too hacky, but anyways work

Sorry, I didn't read that, guess we must have cross-posted :)

I would expect a `nodebox` visual wouldn't be too hard to implement given that nodeboxes are converted to meshes anyway, iirc. I am not sure how involved it would be code-wise or whether the developers would even consider this worthwhile.

Meshes are way more versatile and efficient, however, there does seem to be a demand for this seeing the number of mods that currently (ab)use this method. I guess it's because many people are afraid of 3d editors, esp. blender. Does Rubenwardy's NBE app not have a feature to export as .obj or something?

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Fri Jan 05, 2018 19:01
by Sires
stu wrote:
Sires wrote:The solved I guess because I found it myself, I wrote your solution in the Edit2, but I think it's too hacky, but anyways work

Sorry, I didn't read that, guess we must have cross-posted :)

I would expect a `nodebox` visual wouldn't be too hard to implement given that nodeboxes are converted to meshes anyway, iirc. I am not sure how involved it would be code-wise or whether the developers would even consider this worthwhile.

Meshes are way more versatile and efficient, however, there does seem to be a demand for this seeing the number of mods that currently (ab)use this method. I guess it's because many people are afraid of 3d editors, esp. blender. Does Rubenwardy's NBE app not have a feature to export as .obj or something?


Maybe I'm dumb and I'm implementing the .obj wrong but the obj is the description of what happens when I try to use the nodebox parameter(I was using a mesh parameter at the same time so the mesh is pretty buggy), buy anyway, It's real buggy the thing that results from the .obj for me

Also I said many times, blender is too complicated for my brain ;-; if there was a simpler 3d editor that is just like rubenwardy's NBE I would love it

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Fri Jan 05, 2018 19:39
by rubenwardy
Sires wrote:Also I said many times, blender is too complicated for my brain ;-; if there was a simpler 3d editor that is just like rubenwardy's NBE I would love it


NBE can export to .obj, but it's unoptimised. It's better to use node boxes in most cases.

Re: [Solved, I guess] Is it possible to use nodeboxes in ent

PostPosted: Fri Jan 05, 2018 20:45
by stu
rubenwardy wrote:
Sires wrote:Also I said many times, blender is too complicated for my brain ;-; if there was a simpler 3d editor that is just like rubenwardy's NBE I would love it


NBE can export to .obj, but it's unoptimised. It's better to use node boxes in most cases.


I am pretty sure the meshes generated by the `wielditem` visual are also sub-optimal, otherwise you could just borrow the code from there, right?

For nodes however, I agree, nodeboxes still very much have their place.

Re: [Solved] Is it possible to use nodeboxes in entities

PostPosted: Fri Jan 26, 2018 06:42
by Rochambeau
So what you both are saying is that nodebox mobs are more ressource hungry than similar Blender/Wings3D meshes (without animation of course), because the nodeboxes have to be converted to meshes by the engine?

Can I somehow get those converted meshes and save minetest this step?

Re: [Solved] Is it possible to use nodeboxes in entities

PostPosted: Fri Jan 26, 2018 18:48
by stu
Rochambeau wrote:So what you both are saying is that nodebox mobs are more ressource hungry than similar Blender/Wings3D meshes (without animation of course), because the nodeboxes have to be converted to meshes by the engine?

Can I somehow get those converted meshes and save minetest this step?


The meshes generated by the engine may have a few unnecessary faces as compared to a well designed mesh. Unless you spawn hundreds of entities in a very small area you are unlikely to see any tangible performance improvement. The biggest advantage of meshes IMO is that you have much greater control over the texturing.