Jump to content

[1.12] Mob Key Frame Animation??


Electric

Recommended Posts

So I'm wondering how I can make my mob do sort of a key frame animation. Right now I've got a simple rotation: 

public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {

        if (playerRightClicked) {
            Block13.rotateAngleX = 2F;
        } else {
            Block13.rotateAngleX = 0F;
        }
    }

 

I'm hoping to somehow make it so each tick causes the Block13 to be rotated 0.5 more. Is there an easy way to accomplish this?

Link to comment
Share on other sites

Block13.rotateAngleX = Math.toRadians((float)entityIn.ticksExisted / 2);

 

Additionally models are singletons. If you change a value of a fieldin your model it will apply to all your entities. I am talking about this:

1 hour ago, Electric said:

if (playerRightClicked) {

 

Link to comment
Share on other sites

6 hours ago, V0idWa1k3r said:

Block13.rotateAngleX = Math.toRadians((float)entityIn.ticksExisted / 2);

 

Additionally models are singletons. If you change a value of a fieldin your model it will apply to all your entities. I am talking about this:

 

Thank you so much! Now I've got the beginning of an animation, but is there a way to reset the entityIn#ticksExisted on each right click, so that the animation will begin at the same point each time?

 

And oops, I didn't realize this makes each of my entities do the same animation at the same time. How could I have the animation apply only to the entity being interacted with? I'm guessing it has something to do with entityIn#getEntityId, but I'm not sure. Does everything I do in the mob's model class affect each of my custom mobs?

Link to comment
Share on other sites

10 minutes ago, Electric said:

is there a way to reset the entityIn#ticksExisted on each right click, so that the animation will begin at the same point each time?

Have your own counter field in your entity class and increment it each tick, then reset when needed.

 

12 minutes ago, Electric said:

How could I have the animation apply only to the entity being interacted with?

Move this field to your entity class, then access it from your model when needed. This is a basic OOP concept.

 

12 minutes ago, Electric said:

Does everything I do in the mob's model class affect each of my custom mobs?

As I've said models are singletons. Any change made to the model will affect rendering of all your entities which use that model.

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.