Jump to content

How choose depth of my entity hitbox ?


Plaigon

Recommended Posts

Hello, today i'd like to know how it would be possible to make a entity hitbox depth parameter no relative to its width, like minecraft does by default. I mean that i have a large entity on the z-axis, i just wanted to know how, by editing some entity functions or by a coremod, decide the depth, like a Entity#setSize with a third parameter. Thanks in advance !

  • Like 1
Link to comment
Share on other sites

You can't, depth and width have to be the same. This is because, for performance reasons things like path finding and collision checking need to be simplified. For the same reason the hitbox doesn't rotate even if the entity model does.

 

The only way to make an irregular hitbox is to actually make multiple hit boxes. There are many ways to do that, but one way is to make invisible entities that track along with your entity and have hitboxes, like multipart entities like dragon do.

Edited by jabelar
  • Thanks 1

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

Link to comment
Share on other sites

This is not at all the easiest way to achieve what i want. I mean that i added a bus, and because of the fact that hitboxes do not support rotations, all will be very difficult, and even worse if i decided to create fake entities. No one knows a library which succeed in doing the feature of a third setSize parameter: the depth ? I read some topics, but nothing conclusive about that :/
Anyway thanks jabelar for your quick answer !

Link to comment
Share on other sites

54 minutes ago, Plaigon said:

This is not at all the easiest way to achieve what i want. I mean that i added a bus, and because of the fact that hitboxes do not support rotations, all will be very difficult, and even worse if i decided to create fake entities. No one knows a library which succeed in doing the feature of a third setSize parameter: the depth ? I read some topics, but nothing conclusive about that :/
Anyway thanks jabelar for your quick answer !

There is a very good reason they did not allow rotation or irregular bounding boxes. If you allow rotation then every pathfinding and collision detection method would require many, many times more processing there would be lots of trigonometry and you'd have to know the relative position to understand the perspective when trying to interact with it and so on) and it would be a performance problem. 

 

Basically this is Minecraft and that means "blocky". So just like Minecraft's own large multipart entities using multiple hitboxes is the best way, even though I understand it will be annoying to program and also won't give a perfect effect.

 

I'm not saying it is impossible to change but it would require re-writing lots of somewhat advanced code. You would need to re-write the ray-tracing code to look for your bus entity, you would need custom collision checking for your bus entity, and you would need custom path-finding. Each of these mainly involves just a lot of trigonometry.

  • Thanks 1

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

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Please share a link to your crash report on https://paste.ee, as explained in the FAQ. Dumping it directly into the thread often triggers the anti-spam and makes it hard to read due to word wrapping
    • Hi all, I'm running a 1.20.1 Minecraft Forge server with a hosting website and something seems to have gone wrong. It started as an occasional crash that has now become extremely frequent and I don't know what exactly is causing it. I already tried disabling watchdog but the server crashes anyway. Oddly it only occasionally generates a crash report after a crash occurs. Based on viewing the server console's research usage it seems that the CPU spikes astronomically high (100% usage), especially when chunks are being loaded or when a new person joins the server. I downloaded Spark to create a profile (https://spark.lucko.me/bBlWe7ou29) but I lack experience with this mod and don't understand what I'm looking at/how this should help me diagnose the issue. I am using a lot of mods so I'm guessing there is some sort of issue there or a corrupted chunk (although MCRF found no chunk errors). We actually don't experience any lag until the crash occurs, so it's some sort of sudden spike in resource usage. Based on the crash report I've already tried removing Canary and Modernfix but there was no change. Thanks for any help you can provide. Specs:  4 cores x 4200MHz AMD Ryzen 9 5950X 4GB RAM Crash report:  
    • will test that once i get home, thanks
    • I am getting this exception (I am new and just trying to create an item) Caused by: java.io.FileNotFoundException: abrasmagics:models/item/ingot_test.json at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]   However the directory is set up correctly and the file does exist   idk how to upload images so here is a treeview of the directories:   src ├───main │ ├───java │ │ └───net │ │ └───abrasmods │ │ └───abrasmagics │ │ ├───init │ │ ├───items │ │ └───utils │ │ ├───handlers │ │ ├───misc │ │ └───proxy │ └───resources │ └───assets │ └───abrasmagics │ ├───models │ │ ├───block │ │ └───item │ └───textures └───test ├───java └───resources   the file ingot_test.json is under models/item. The directory seems fine and the file does exist so anyone plz help.   i am using intellij and is coding for 1.12.2
  • Topics

×
×
  • Create New...

Important Information

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