Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

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/

  • Author

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

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.

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

  • Author

Awesome, setRotationPoint works great in moving each block's position. Thanks for the help, Jabelar!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.