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.

Announcements



×
×
  • Create New...

Important Information

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