Jump to content

PositionPolygon question


Recommended Posts

Posted

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.

  • Like 1
Posted (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 by josedpay
Posted

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()).

 

:)

  • Like 1
Posted (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 smile.png

Edited by Pandemic
  • Like 1
Posted

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 smile.png

thanks for the help, i guess i did something wrong somewhere ill look into it later

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...