Posted July 29, 20178 yr 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?
July 29, 20178 yr 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) {
July 30, 20178 yr Author 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?
July 30, 20178 yr 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.
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.