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

    • diesieben07
      whenever I join a server it shows me this error

      By diesieben07 · Posted 17 minutes ago

      1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • diesieben07
      Cant Get a Config File Working 1.16.5

      By diesieben07 · Posted 18 minutes ago

      Git is not the right way to store worlds or other large files.   There is no such line in the repository you posted. I used the debugger and put a breakpoint in the FMLCommonSetupEvent handler. Then I used evaluate expression and ArmorConfig.COMMON.enableOakWood.get() was false, as expected.
    • gamer650xd
      whenever I join a server it shows me this error

      By gamer650xd · Posted 22 minutes ago

      crash-2021-01-16_21.37.09-client.txt
    • Bailym
      Cant Get a Config File Working 1.16.5

      By Bailym · Posted 23 minutes ago

      I initially removed the .gitignore because i wanted to preserve the world saves, ill add it back in with the necessary exceptions.   Just to clarify. If you set enableOakWood to false in extraarmor-common.toml the line    System.out.println(ArmorConfig.COMMON.enableOakWood.get()); //Always True   returns false as expected? As i'm not getting the same behavior
    • gamer650xd
      whenever I join a server it shows me this error

      By gamer650xd · Posted 26 minutes ago

      internal exception: com.google.common.util.concurrent.UncheckedExecutionException:net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Minecraft Forge (forge)   crash-2021-01-16_21.37.09-client.txt
  • Topics

    • gamer650xd
      2
      whenever I join a server it shows me this error

      By gamer650xd
      Started 26 minutes ago

    • Bailym
      11
      Cant Get a Config File Working 1.16.5

      By Bailym
      Started 1 hour ago

    • e2rifia
      4
      (1.16.2) How do I use onPlayerTick?

      By e2rifia
      Started 3 hours ago

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

      By kiou.23
      Started 9 hours ago

    • Ipsissimus418
      1
      [1.16.4] WorldTickEvent Concurrent Access Exception

      By Ipsissimus418
      Started 51 minutes ago

  • Who's Online (See full list)

    • diesieben07
    • kreezxil
    • JackRaidenPH
    • qwepo
    • Caaruzo
    • Telmoun
    • st4s1k
    • e2rifia
    • Talp1
    • Bailym
    • LeoBeliik
    • Kikoz
    • Beethoven92
    • Pl00py_R
    • gamer650xd
    • vemerion
    • KickPotato
    • Boetam
  • 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