Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4] [Solved] Bounding Box
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 2
BudRunBun

[1.14.4] [Solved] Bounding Box

By BudRunBun, July 21, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020 (edited)

I have a block with shape of right triangular prism. How do I create BB for it(I saw only voxel shapes which are cubes and I don't know how to make a side which is rotated)?

Edited July 23, 2020 by BudRunBun
  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020 (edited)

I know that it is in fact possible to construct a triangle out of infinitely many rectangles but I believe that there is a more convenient way to do this.

Edited July 21, 2020 by BudRunBun
  • Quote

Share this post


Link to post
Share on other sites

matt1999rd    3

matt1999rd

matt1999rd    3

  • Creeper Killer
  • matt1999rd
  • Members
  • 3
  • 126 posts
Posted July 21, 2020

for voxelshape it is impossible to make diagonal shape unfortunately. But what you can do is make cuboid that match your form correctly but I don't know if it is what you want..

  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020

I just want BB that will match my texture

  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020
1 hour ago, matt1999rd said:

for voxelshape it is impossible to make diagonal shape unfortunately. But what you can do is make cuboid that match your form correctly but I don't know if it is what you want..

How do I do that?

  • Quote

Share this post


Link to post
Share on other sites

matt1999rd    3

matt1999rd

matt1999rd    3

  • Creeper Killer
  • matt1999rd
  • Members
  • 3
  • 126 posts
Posted July 21, 2020

you can use blockbench to visualised your bounding boxes and then add them with block.makecuboidShape to get one box and then VoxelShapes.or to make a shape that is the sum of multiple voxelshapes.

  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020

This works but it looks like an overkill solution

//number of partitions
private static final int n = 150;
private static VoxelShape shape = VoxelShapes.empty();

static {
    //creating triangular shape of rectangles
    for (int p = 0; p < n; p++) {
        shape = VoxelShapes.or(shape, VoxelShapes.create((double) p / n, 0.0D, 0.0D, (double) (p + 1) / n, (double) (p + 1) / n,  1.0D));
    }
}
  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020 (edited)

Now I have 2 problems:

1)When I break it it produces ton of particles

2)It has a very unpleasant shade from rotated side(Don't pay attention to the texture, it is only for testing)2020-07-22_01_30_00.thumb.png.3ea5f20efc1b47ce5ec25d0bec7a025b.png

Edited July 21, 2020 by BudRunBun
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2401

Draco18s

Draco18s    2401

  • Reality Controller
  • Draco18s
  • Members
  • 2401
  • 15918 posts
Posted July 21, 2020

Don't use such small slices.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 21, 2020

But how do I make a triangle then?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2401

Draco18s

Draco18s    2401

  • Reality Controller
  • Draco18s
  • Members
  • 2401
  • 15918 posts
Posted July 21, 2020

You can't. And the reason it goes "sorta gray" is because you have 150 edges there.

Vanilla only uses three for the lecturn!

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

poopoodice    109

poopoodice

poopoodice    109

  • Dragon Slayer
  • poopoodice
  • Members
  • 109
  • 879 posts
Posted July 21, 2020

You can't afaik. For example lectern's bounding boxes is a combination of  +-4 cubes, and even entities' bounding boxes they can't and they don't rotate.

  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 22, 2020 (edited)

Okay, I will lower the number of partitions. Is there any way not to display BB? It looks bizarre.

Edited July 22, 2020 by BudRunBun
  • Quote

Share this post


Link to post
Share on other sites

vemerion    56

vemerion

vemerion    56

  • Creeper Killer
  • vemerion
  • Members
  • 56
  • 220 posts
Posted July 22, 2020 (edited)
5 hours ago, BudRunBun said:

Is there any way not to display BB

You could cancel the HighlightBlock event to hide the bounding box.

Edited July 22, 2020 by vemerion
Corrected event name
  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 23, 2020 (edited)

Is it in theory possible to make a BB via custom algorithm(convex hull) or things are hard-coded with voxelshapes?

Edited July 23, 2020 by BudRunBun
  • Quote

Share this post


Link to post
Share on other sites

vemerion    56

vemerion

vemerion    56

  • Creeper Killer
  • vemerion
  • Members
  • 56
  • 220 posts
Posted July 23, 2020
3 hours ago, BudRunBun said:

Is it in theory possible to make a BB via custom algorithm(convex hull) or things are hard-coded with voxelshapes?

As far as I know, voxelshapes are the way to go.

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2401

Draco18s

Draco18s    2401

  • Reality Controller
  • Draco18s
  • Members
  • 2401
  • 15918 posts
Posted July 23, 2020
6 hours ago, BudRunBun said:

Is it in theory possible to make a BB via custom algorithm(convex hull) or things are hard-coded with voxelshapes?

Here's a hint: Axis Aligned Bounding Boxes are:

(1) Axis aligned. This means no rotation.

(2) Boxes. This means they are cuboids.

 

VoxelShape is just a wrapper around a list of AABBs providing various helper methods.

  • Thanks 1
  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

BudRunBun    0

BudRunBun

BudRunBun    0

  • Stone Miner
  • BudRunBun
  • Members
  • 0
  • 72 posts
Posted July 23, 2020

Yes but getShape() method in Block class return VoxelShape and I can't make it return sth else

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2401

Draco18s

Draco18s    2401

  • Reality Controller
  • Draco18s
  • Members
  • 2401
  • 15918 posts
Posted July 23, 2020

You can't just go around changing the return type. That's not how programming works.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 2
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Thorius
      [1.15.2] How Would I make a custom bow?

      By Thorius · Posted 38 minutes ago

      You have to create a new bullet entity class but you can use the snowball as a template. In kinematics there's not much difference between a snowball and a bullet. If it looks and hurts like a bullet then it's a bullet. But you have to register it as a new entity.
    • Ipsissimus418
      [1.16.4] WorldTickEvent Concurrent Access Exception

      By Ipsissimus418 · Posted 56 minutes ago

      That is something I hadn't considered in terms of threads.   I have the WorldTickEvent handler do nothing on the client but run on the server. I may have some paths for the addEntry running on both the client and server. Something I need to look into and check if that is where the conflict is coming from.   Thanks.
    • kiou.23
      [1.16] Custom Sign won't render

      By kiou.23 · Posted 1 hour ago

      Did the classes, now the edit screen shows up, and if I use a vanilla WoodType for the sign, the texture shows up in the edit screen (not in the actual block tho, it still won't render) the changes are on github. How should I go about rendering the Sign again? I'll need to write my own TileEntityRenderer?
    • PedreHenrry
      my minecraft crashed by "rendering overlay"

      By PedreHenrry · Posted 1 hour ago

      i fixed it re instaling the forge after delete it  
    • Somonestolemyusername
      [1.15.2] How Would I make a custom bow?

      By Somonestolemyusername · Posted 1 hour ago

      but if I use the snowball class it will be like im shooting snowballs not bullets. you know mr crayfishes gun mod? i want my gun to be somewhat like that also i figured out how to connect my registered object to the class
  • Topics

    • Somonestolemyusername
      14
      [1.15.2] How Would I make a custom bow?

      By Somonestolemyusername
      Started Tuesday at 09:30 PM

    • Ipsissimus418
      2
      [1.16.4] WorldTickEvent Concurrent Access Exception

      By Ipsissimus418
      Started 2 hours ago

    • kiou.23
      14
      [1.16] Custom Sign won't render

      By kiou.23
      Started 11 hours ago

    • PedreHenrry
      5
      my minecraft crashed by "rendering overlay"

      By PedreHenrry
      Started Yesterday at 01:06 PM

    • e2rifia
      2
      (1.16.2) Making a new capability(2)

      By e2rifia
      Started 1 hour ago

  • Who's Online (See full list)

    • Lucie
    • By_Chrome
    • GalaxianLukeR
    • MistyMarshes
    • raytracy86
    • tf2_mandeokyi
    • Tavi007
    • Alexalien
    • Tehen
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4] [Solved] Bounding Box
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community