Jump to content

Oriented Bounding Box


Dyrax

Recommended Posts

I am trying to make a very long but thin entity. If I use the standard axis aligned bounding boxes, the box is very inaccurate if the entity rotates. I saw that minecraft uses multiple entities for the ender dragon. Is there another way to fix my problem because I would need a lot of sub entities and the box would probably still be inaccurate. Can I sub class AxisAlignedBB somehow without creating compatibility issues?

Link to comment
Share on other sites

No, the bounding box is always a square base and doesn't rotate. This is because it greatly simplifies pathfinding and collision checking and so is important for performance reasons. 

 

So for any unusually shaped bounding box you'll need to create some additional invisible "hitbox entities". You don't need to break your actual entity into different parts, you just need to place the invisible entities in the right places (that will still take some math to get right since you'll probably want to consider rotation). If the hitbox entity gets hit then you notify the parent entity and perform the intended action.

 

Definitely a pain,  but also definitely possible to achieve with a bit of thought.

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.