Joseph Posted June 25, 2014 Posted June 25, 2014 i want to use position polygon to determine if it contains an entity. They have a method that accepts Vector3D. i looked into entity and they have a super of Vector3D. Vector3D and Position are the same thing except for it being different data types. so my question is how would i use the method contains(vector3d) with my entity? i already tryed putting the entity in the argument but it didnt work out. 1
triggamortis Posted June 25, 2014 Posted June 25, 2014 u should read the documentation of it. hope this helps. You should probably explains "specifically" what you are trying to do' but based on what u wrote(clarify if im wrong), it seems you just wanna check if there is an entity on a tile? If so, then do a loop of npcs in your region and check the tile of the npc. http://osbot.org/api/org/osbot/rs07/api/map/PositionPolygon.html
Joseph Posted June 25, 2014 Author Posted June 25, 2014 (edited) u should read the documentation of it. hope this helps. You should probably explains "specifically" what you are trying to do' but based on what u wrote(clarify if im wrong), it seems you just wanna check if there is an entity on a tile? If so, then do a loop of npcs in your region and check the tile of the npc. http://osbot.org/api/org/osbot/rs07/api/map/PositionPolygon.html im trying to check to see if the entity is within that position polygon which they said it's the new "area wanna be class" Edited June 25, 2014 by josedpay
Pandemic Posted June 25, 2014 Posted June 25, 2014 i want to use position polygon to determine if it contains an entity. They have a method that accepts Vector3D. i looked into entity and they have a super of Vector3D. Vector3D and Position are the same thing except for it being different data types. so my question is how would i use the method contains(vector3d) with my entity? i already tryed putting the entity in the argument but it didnt work out. You can pass a Position instead of Vector3D, so just do positionPolygon.contains(entity.getPosition()). 1
Joseph Posted June 25, 2014 Author Posted June 25, 2014 (edited) You can pass a Position instead of Vector3D, so just do positionPolygon.contains(entity.getPosition()). let me try it out real quick, it isnt working for me Edited June 25, 2014 by josedpay
Pandemic Posted June 25, 2014 Posted June 25, 2014 (edited) let me try it out real quick, it isnt working for me Make sure you're importing the new Position/Entity and not the legacy. PositionPolygon positionPolygon = new PositionPolygon(); Position p = new Position(0, 0, 0); if (positionPolygon.contains(p)) { //Whatever } Is working for me Edited June 25, 2014 by Pandemic 1
Joseph Posted June 25, 2014 Author Posted June 25, 2014 Make sure you're importing the new Position/Entity and not the legacy. PositionPolygon positionPolygon = new PositionPolygon(); Position p = new Position(0, 0, 0); if (positionPolygon.contains(p)) { //Whatever } Is working for me thanks for the help, i guess i did something wrong somewhere ill look into it later