Jump to content

Large entity hitbox not filling up entire space


Adityagupta

Recommended Posts

I have created an entity that is ~70 blocks tall and ~6 blocks wide, and I have set its hitbox so that when I press F3 + B, it fills up the entire entity. However, I can only interact (hit) the bottom ~4 blocks, and when I look too far up, the entity disappears entirely (I think this is because the subchunk in which those ~4 blocks are in is not loaded). I have noticed the same issue with the vanilla giant mob, which also disappears at certain angles and also has a bugged hitbox. I have seen a few threads about this same problem, but none of them had a solution for this problem.

 

Entity hitbox:

 

2019-04-01_22_48_52.thumb.png.1e1310783d3309941744a47f3a0b57af.png

 

Same view but a bit higher up:

 

2019-04-01_22_48_56.thumb.png.f806697be1cfbc292c0d5b0b69706c04.png

 

I tried setting ignoreFrustumCheck to true, as well as forcing some render methods to always return true for "should render", but none of that worked. The source code can be found here. The entity in question is here.

 

Any ideas?

Link to comment
Share on other sites

11 minutes ago, Adityagupta said:

when I look too far up, the entity disappears entirely

AFAIK this s due to the chunk(s) the entity is in is being culled; there is not much you can do about it.

One way too circumvent this problem would be to break your large entity into multiple smaller entity (like how "dragon" entities are handled in some mods).

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

1 minute ago, DavidM said:

AFAIK this s due to the chunk(s) the entity is in is being culled; there is not much you can do about it.

I know this is the problem, but wouldn't fixing the hitbox size put the entity in more chunks so it wouldn't be culled? Or can entities only be tied to a single chunk?

If there isn't a fix for the hitbox/culling, I'll just go with multiple parts. 

 

Also, I saw an issue on Advanced Rocketry for the same problem, and it said there was a pull request that fixed it, but the same issue seems to be happening here.

Link to comment
Share on other sites

While I haven't looked into the actual code for it, I believe MC entities are only tied to a single chunk (ie. the chunk containing their origin point), which would cause these kinds of issues (based on several related forum/chat posts I've seen).  Also, based on how the collision detection and several other systems work...
 

Going along with the "I've seen posts of" line of thought, I've seen several posts suggesting to do as DavidM said, and split your entity into smaller parts, basically improving the "granularity" of what's culled due to chunk culling.

 

Edit: I believe for entities which are holding still, you could just split the entity into one part per chunk, if you get my drift.  For large moving entities, I'm guessing it would be better to have a pre-defined set of parts instead of trying to constantly recalculate entity sections based on chunk boundaries in relation to the entity :P

Edited by Laike_Endaril
Link to comment
Share on other sites

46 minutes ago, Adityagupta said:

Could a possible solution be to constantly move the origin of the entity so that it's always in the frustum and simply translate the model so it looks like it's staying in the same place?

If I understood correctly, no.

Different players might be looking at different directions, but the entity can only have one position.

 

Even if the mod is for single player only, the position of an entity shouldn't be abused for cosmetic (rendering) purposes; the position of an entity does a lot more than "keeping the entity visible", and messing with it can break other things.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

14 minutes ago, DavidM said:

Even if the mod is for single player only, the position of an entity shouldn't be abused for cosmetic (rendering) purposes; the position of an entity does a lot more than "keeping the entity visible", and messing with it can break other things.

Good point, I think I'll just stick with multiple parts. Are IEntityMultiPart and MultiPartEntityPart (the ones used in EntityDragon) the best for this or is there a better method?

Link to comment
Share on other sites

I did some more testing and I found the point in vanilla where the bug was fixed. The bug exists up to snapshot 19w05a, but in 19w06a, it seems to be fixed. I can't seem to find the exact bug that caused it (https://minecraft.gamepedia.com/19w06a#Fixes), so does anyone know if there is a way to find out and maybe implement that in my own code?

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.