Jump to content

[1.12.2] How to translate parts of custom entity up and down? [SOLVED]


Recommended Posts

Posted (edited)

I have been able to successfully rotate specific parts of my custom entity, using Block.rotateAngleY within this method of the model class:

public void setLivingAnimations(EntityLivingBase entityIn, float limbSwing, float limbSwingAmount, float partialTickTime)

 

Now I'm trying to figure out how to move specific parts up and down. Using the same method above, I tried using Block.offsetY, but it has absolutely no effect. Any ideas on how I can translate specific sections of my entity?

Edited by Electric
marked as solved
Posted

In your model class you should be able to change the position of each box part. Note that changing offset will change the rotation point within the block -- it will appear to move but will also rotate differently. Changing the pos will move the whole thing and keep the rotation point in same location.

 

In any case can you post your whole code, at least for the model class?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

My model consists of a center that I would like to rotate and spin independently of the rest of the model. Right now, it's able to spin using rotateAngleY and values from a capability that stores an increasing int every tick after a player interacts with the entity. I would like to have the center similarly move up and down as well. 

 

Here is my long model file:

https://pastebin.com/ZHT8AZNC

Posted

Wow, that's a pretty crazy model (in terms of there is a lot of boxes).

 

Instead of changing the offset I think you need to use the setRotationPoint() method. That is what places the rotation point in 3D space relative to the entity position.

 

The way it works, if I remember correctly is:

1) You create a box by specifying the size in x, y, z.

2) You also specify the offset which is the point WITHIN the box where rotation occurs.

3) You then need to specify the rotation point which is actually placing the block in space. 

4) You can then set rotation angle (around that point).

 

Note that I believe that the naming of the methods is sort of misleading. You would think that setting the rotation point would imply setting the point within the block where it rotates; but it is the opposite, the offset does that and the set rotation point actually moves the whole block.

 

Anyway, that is what I remember from when I used to do complicated animations.

 

Also, for easier debugging you might want to try a much simpler model. Like maybe just make one block that you can control up and down first.

  • Like 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.