Jump to content

[1.11.2] Animating a block model


DrLogiq

Recommended Posts

So I know, I know... people have asked about things like this before. But from what I've seen, nobody's given a simple, straightforward explanation, which is all I need.

I have a custom model, not too complex, just 8 parts is all. I would like to be able to have 5 of these parts rotating constantly (based on a boolean variable in the TileEntity being true), around ONE of their local axes (preferably in a way that is block-rotation friendly). Obviously this would be on a per-block basis.

 

Iiiii... do not know how to do this. I'm no JSON guru, and in fact, I don't like JSON ~.~

I hear Forge has some sort of animation system, using joints and what-not? This sounds great. If some legend can give me the most basic run-down of how I can achieve such a seemingly simple goal like rotating some model parts constantly around one of their own axes (either X or Z, one of the two), that'd be great, since so far everyone just says "here go look at this" and pastes a link, that takes you to a piece of code from someone's mod where you can see the JSON file, but there's no explanation (or a really, REALLY poor one that's incomprehensible), and that's it -.-

 

If this can be done in the JSON file or the TileEntity or the Block, which-ever's best, as long as it's server friendly and works. I don't know what the most optimized option would be, considering players are likely to want a lot of these blocks in their world, but I'm sure someone somewhere does.

 

Many thanks for reading, and if you try to help... extra thanks and a hypothetical cold beer on me! ^.^

Link to comment
Share on other sites

For this you should use a FastTESR.  There is an animation API in JSON, but it's limited.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I've heard TESR's are best avoided due to being performance intensive, I guess that might not be true for the fast one though? How may I reference / access my model's parts via the Java code? Also thanks for the quick response :)

Link to comment
Share on other sites

FastTESR is still slower than IBakedModel, but it's more performant than a regular TESR

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

So I've been fiddling about with these a little bit. I can't figure out how to make it rotate the parts and render them.

Please could you be so kind as to provide some intel on how to actually make this work? I've Googled for hours and tried so many things, dug through a lot of Minecraft's code and every time I try something, it just renders the model as it's normal static model.

 

To recap what I'm looking to do:

  • Place my block (with a custom model) in 1 of 4 horizontal directions, depending on where on the block I click
    • (See ImmersiveEngineering's conveyor belt for an example)
  • Rotate 5 of the model's parts constantly, over time, perpendicular to the block's placement direction
  • Render the other 3 parts normally

It seems other people are having similar difficulties too. There's no documentation, tutorials etc for TESR's, and the small amount of information I've been able to excavate from the deep crevices of the god damn internet has been so unsubstantial that I might as well have asked my dead cat. Hopefully anyone readying this knows at least enough to help a tired programmer out? Also please take into consideration that I only know the most basic level of OGL. Rendering things isn't my forté :/

 

Many thanks.

-Logiq

Link to comment
Share on other sites

There are overwhelming amounts of great documentations on opengl lut there, so I guess you won't have much problem with it.

 

I found this post from quick Google search on FastTESR.

Based on the answers, you can specify the vertex positions, uvs and colors on FastTESR.

(There are more props but these are basically what you would need)

 

Figure out the math for your case, i.e. calculating the positions of each vertice of the block. Then it's just matter of notifying vertexbuffer about the vertices in right order. (Give every information -pos,uv,color- for a vertex and move over to the next one)

Don't forget to stitch textures on the texture map.

 

As far as I know, you can't overlap TESR(or FastTESR) and normal model. So I guess you should render other 3 parts with FastTESR as well.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.