Jump to content

[Solved] [1.15.2] Entity jitters when moving


SuperManitu

Recommended Posts

Hi,

I am creating a custom Entity (not a LivingEntity) and for starters I gave it a constant movement in one direction. But for some reason, the Entity jitters the whole time, unlike normal entities like the minecart and I don't really understand where this is coming from.

Here is a video where you can see (some of) the jittering: https://cdn.discordapp.com/attachments/454376090362970122/756140763338899616/movement2.mp4

Entity code: https://pastebin.com/ZAmp224b

Renderer: https://pastebin.com/gu34g7Ft

The interpolation in the renderer is done by this method:

public static <T extends Entity> Vec3d getMoveLerp(double partialTicks, T entity) {
  double x = MathHelper.lerp(partialTicks, entity.prevPosX, entity.getPosX());
  double y = MathHelper.lerp(partialTicks, entity.prevPosY, entity.getPosY());
  double z = MathHelper.lerp(partialTicks, entity.prevPosZ, entity.getPosZ());
  return new Vec3d(x - entity.prevPosX, y - entity.prevPosY, z - entity.prevPosZ);
}

 

I've tried using the default update and tracking range as well as 20 and 80 respectively without visible changes.

Thanks

Edited by SuperManitu
Link to comment
Share on other sites

The tracking range shouldn't really have an effect on it. A question for you is why do you need to lerp movement? The place the entity is positioned in the world should be synced to the renderer if I'm not mistaken. Lerping the position would just cause the calculations to lag slightly behind and repeat the same motion. This is my understanding of the renderer system anyways.

Link to comment
Share on other sites

I know how linear interpolation works, but you seem to have not read my entire post. If the movement of the entity is global, then the lerping should will happen already from the entity movement. However, if it's happening relative to the model, then that's where you would need to do you own manual interpolation. Else, you are just interpolating what's already has been interpolated. You can view this within BoatRenderer. There is no interpolation for the movement, just the rotation of the model pieces.

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.