Jump to content

Hitboxes and size?


Krevik

Recommended Posts

Hi! I've got problem with mob hitboxes. Mob is really big. I set it size using setSize(48F,12F) so as you can see it's huge. Hitboxes shown ingame are ok, but there's problem with hitting it. The mob can be hit only by hitting it in the real center. Hitting borders even if they're in the hitbox range doesn't effect. Is there any way to fix it? https://imgur.com/pITIVs7

Edited by Krevik
Link to comment
Share on other sites

I think it should work. I've done giants and dinosaurs before. The vanilla giant zombie is 6 times regular zombie size and the main part of a vanilla dragon is 16 by 8.

 

There might be a limit though. Maybe start small and increase it a bit at a time to see if there is an actual limit. 

 

I looked through the code a bit. The key bit of code is the EntityRenderer.getMouseOver() method. This is what decides if the player is clicking on an entity. One thing I noticed is that one thing it does it it narrows down the entities to check for using the World.getEntitiesWithinAABBExcludingEntity() method. I looked at that method and it actually has a comment that there is a MAX_ENTITY_RADIUS field that:

     * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
     * Modders should change this variable to a higher value if it is less then the radius
     * of one of there entities.

 

This field is a public static field so is accessible for you. So I think what you need to do is at some time during loading you need to set that field to the size of your entity. 

 

The default is 2. So it makes sense that you might need to change this in your case.

 

Anyway, try that and see if it works.

  • Like 1

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

Link to comment
Share on other sites

7 hours ago, jabelar said:

I think it should work. I've done giants and dinosaurs before. The vanilla giant zombie is 6 times regular zombie size and the main part of a vanilla dragon is 16 by 8.

 

There might be a limit though. Maybe start small and increase it a bit at a time to see if there is an actual limit. 

 

I looked through the code a bit. The key bit of code is the EntityRenderer.getMouseOver() method. This is what decides if the player is clicking on an entity. One thing I noticed is that one thing it does it it narrows down the entities to check for using the World.getEntitiesWithinAABBExcludingEntity() method. I looked at that method and it actually has a comment that there is a MAX_ENTITY_RADIUS field that:


     * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
     * Modders should change this variable to a higher value if it is less then the radius
     * of one of there entities.

 

This field is a public static field so is accessible for you. So I think what you need to do is at some time during loading you need to set that field to the size of your entity. 

 

The default is 2. So it makes sense that you might need to change this in your case.

 

Anyway, try that and see if it works.

Thank you so much jabelar! I think it should work, anyway will try it soon

Link to comment
Share on other sites

On 6/20/2018 at 6:41 AM, jabelar said:

I think it should work. I've done giants and dinosaurs before. The vanilla giant zombie is 6 times regular zombie size and the main part of a vanilla dragon is 16 by 8.

 

There might be a limit though. Maybe start small and increase it a bit at a time to see if there is an actual limit. 

 

I looked through the code a bit. The key bit of code is the EntityRenderer.getMouseOver() method. This is what decides if the player is clicking on an entity. One thing I noticed is that one thing it does it it narrows down the entities to check for using the World.getEntitiesWithinAABBExcludingEntity() method. I looked at that method and it actually has a comment that there is a MAX_ENTITY_RADIUS field that:


     * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
     * Modders should change this variable to a higher value if it is less then the radius
     * of one of there entities.

 

This field is a public static field so is accessible for you. So I think what you need to do is at some time during loading you need to set that field to the size of your entity. 

 

The default is 2. So it makes sense that you might need to change this in your case.

 

Anyway, try that and see if it works.

Tried and it didn't work. Tried puttin World.MAX_ENTITY_RADIUS in entity class, in main class pre init, post init, init methods. Tried setting it to both 12D and 120D. Also tried not using World, but DimensionManager.getWorld(). None of these worked :/ Nothing changed.  Also found out that the problem is only with hitting it with hand/item etc... There is no such problem with arrow. Arrow recognize hitboxes perfectly

Edited by Krevik
Link to comment
Share on other sites

Spoiler

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	World.MAX_ENTITY_RADIUS=12D;
    	OBJLoader.INSTANCE.addDomain(MODID);
    	KetherPacketHandler.init();
    	KCore.instance.dimRegistry();
        //logger = (Logger)event.getModLog();
        proxy.preInit(event);
    }

 

1 minute ago, diesieben07 said:

Show how you tried to change the field. Note: Do not make your own field.

 

 

Link to comment
Share on other sites

20 hours ago, Krevik said:

Tried and it didn't work. Tried puttin World.MAX_ENTITY_RADIUS in entity class, in main class pre init, post init, init methods. Tried setting it to both 12D and 120D. Also tried not using World, but DimensionManager.getWorld(). None of these worked :/ Nothing changed.  Also found out that the problem is only with hitting it with hand/item etc... There is no such problem with arrow. Arrow recognize hitboxes perfectly

 

The fact that arrows work but player hitting doesn't supports my idea that the problem is somewhere in the mouse over method. Once the arrows are flying they use their own collision box to check for collisions. When the player tries to hit something it checks the space around the "look vector" which involves methods like the one I've mentioned.

 

So I still feel the problem can be understood by looking at the EntityRenderer.getMouseOver() method. I'm not certain that radius field is the problem, but it sure sounded like it should be related. Maybe you should use debug mode in Eclipse and set a breakpoint for when user clicks button and step through to see what is happening.

 

  • Like 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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ladangtoto situs resmi ladangtoto situs terpercaya 2024   Temukan situs resmi dan terpercaya untuk tahun 2024 di LadangToto! Dengan layanan terbaik dan keamanan yang terjamin, LadangToto adalah pilihan utama untuk penggemar judi online. Daftar sekarang untuk mengakses berbagai jenis permainan taruhan, termasuk togel, kasino, dan banyak lagi. Jelajahi sensasi taruhan yang tak terlupakan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan LadangToto!" [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
    • WINNING303 DAFTAR SITUS JUDI SLOT RESMI TERPERCAYA 2024 Temukan situs judi slot resmi dan terpercaya untuk tahun 2024 di Winning303! Daftar sekarang untuk mengakses pengalaman berjudi slot yang aman dan terjamin. Dengan layanan terbaik dan reputasi yang kokoh, Winning303 adalah pilihan terbaik bagi para penggemar judi slot. Jelajahi berbagai pilihan permainan dan raih kesempatan besar untuk meraih kemenangan di tahun ini dengan Winning303 [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]] [[jumpuri:❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ > https://w303.pink/orochimaru]]
    • SLOT PULSA TANPA POTONGAN : SLOT PULSA 5000 VIA INDOSAT IM3 TANPA POTONGAN - SLOT PULSA XL TELKOMSEL TANPA POTONGAN  KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • BRI4D adalah pilihan tepat bagi Anda yang menginginkan pengalaman bermain slot dengan RTP tinggi dan transaksi yang akurat melalui Bank BRI. Berikut adalah beberapa alasan mengapa Anda harus memilih BRI4D: Tingkat Pengembalian (RTP) Tertinggi Kami bangga menjadi salah satu agen situs slot dengan RTP tertinggi, mencapai 99%! Ini berarti Anda memiliki peluang lebih besar untuk meraih kemenangan dalam setiap putaran permainan. Transaksi Melalui Bank BRI yang Akurat Proses deposit dan penarikan dana di BRI4D cepat, mudah, dan akurat. Kami menyediakan layanan transaksi melalui Bank BRI untuk kenyamanan Anda. Dengan begitu, Anda dapat melakukan transaksi dengan lancar dan tanpa khawatir. Beragam Pilihan Permainan BRI4D menyajikan koleksi permainan slot yang beragam dan menarik dari berbagai provider terkemuka. Mulai dari tema klasik hingga yang paling modern, Anda akan menemukan banyak pilihan permainan yang sesuai dengan selera dan preferensi Anda.  
    • SPARTA88 adalah pilihan tepat bagi Anda yang menginginkan agen situs slot terbaik dengan RTP tinggi dan transaksi yang mudah melalui Bank BNI. Berikut adalah beberapa alasan mengapa Anda harus memilih SPARTA88: Tingkat Pengembalian (RTP) Tinggi Kami bangga menjadi salah satu agen situs slot dengan RTP tertinggi, mencapai 98%! Ini berarti Anda memiliki peluang lebih besar untuk meraih kemenangan dalam setiap putaran permainan. Beragam Pilihan Permainan SPARTA88 menyajikan koleksi permainan slot yang beragam dan menarik dari berbagai provider terkemuka. Mulai dari tema klasik hingga yang paling modern, Anda akan menemukan banyak pilihan permainan yang sesuai dengan selera dan preferensi Anda. Kemudahan Bertransaksi Melalui Bank BNI Proses deposit dan penarikan dana di SPARTA88 cepat, mudah, dan aman. Kami menyediakan layanan transaksi melalui Bank BNI untuk kenyamanan Anda. Dengan begitu, Anda dapat melakukan transaksi dengan lancar tanpa perlu khawatir.
  • Topics

×
×
  • Create New...

Important Information

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