Butters Posted January 25, 2018 Share Posted January 25, 2018 Howdy ho, Was wondering how you guys draw fancy stuff around entities, say monsters? Atm using something as simple as g2.draw(npc.getPosition().getPolygon(getBot()); Naturally, this draws a square of 1x1 around the entity. Say the entity takes up two grids. Anyway to find that out and draw it? Thanks Quote Link to comment Share on other sites More sharing options...
FrostBug Posted January 25, 2018 Share Posted January 25, 2018 The position you get is anchored South-West, so if the entity is 2x2, your position will be the SW corner. Use the entity size along with the anchor position of the entity to construct the area or polygon. Entity has the getSizeX and getSizeY methods used to get the tile dimensions of an entity, tho unfortunately it's only properly implemented in the RS2Object related entities. If you want to do it for NPCs you will either need to hardcode the size, or do some hacky calculations with the model 1 Quote Link to comment Share on other sites More sharing options...
Butters Posted January 25, 2018 Author Share Posted January 25, 2018 13 minutes ago, FrostBug said: The position you get is anchored South-West, so if the entity is 2x2, your position will be the SW corner. Use the entity size along with the anchor position of the entity to construct the area or polygon. Entity has the getSizeX and getSizeY methods used to get the tile dimensions of an entity, tho unfortunately it's only properly implemented in the RS2Object related entities. If you want to do it for NPCs you will either need to hardcode the size, or do some hacky calculations with the model Thanks, had a hunch it won't be easy. Tried getSizeX() and getSizeY() (both deprecated) on npcs earlier but they returned wrong values. Quote Link to comment Share on other sites More sharing options...