About Store Forum Documentation Contact



Post Reply 
Check if position exist
Author Message
Lancer Offline
Member

Post: #1
Check if position exist
Hi,

is there a way to check if the world position exist/within boundaries?
Can't find anything that I could use to do the check.

Regards
07-09-2019 11:33 PM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #2
RE: Check if position exist
Math\Shapes\Plane.h

Code:
// if point cuts a plane
inline Bool Cuts(C Vec2  &point, C Plane2  &plane)

or
Code:
// return point casted on the plane along the 'plane_normal' ('plane_normal' must be normalized)
Vec2  PointOnPlane(C Vec2  &point, C Vec2  &plane_pos, C Vec2  &plane_normal);
(This post was last modified: 07-09-2019 11:58 PM by Houge.)
07-09-2019 11:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Check if position exist
There are plenty of 'Cuts' functions. Should I rename them to 'Overlaps' or something?
07-10-2019 01:39 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #4
RE: Check if position exist
I don't think it is necessary
07-10-2019 02:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #5
RE: Check if position exist
Hi,

thanks.
But I was more looking for something like "IsInWorldBoundaries".
I only have coordinates of a player and before I want him to be able to enter the world, I need to figure out, if the coordinates are within the world. Otherwise the player would spawn somewhere (if he bugged out of the map somehow). Also need this to avoid people trying to bug out of the world map.
For that I'd need "start" and "end" coordinates of the world map.
Example like in the GUI https://www.esenthel.com/site/docs/image...Window.png there are 2 "start" and 2 "end" coordinates.
07-10-2019 07:46 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Check if position exist
There's no function to get something like that, you could hard code some constants in code for that
07-11-2019 01:02 AM
Find all posts by this user Quote this message in a reply
Lancer Offline
Member

Post: #7
RE: Check if position exist
(07-12-2019 06:45 PM)Zervox Wrote:  you could do a boundary system manually, either by creating dynamic boxes to check against or build them into a custom world area structure. there is functions for Inside(playerpos, box)

just as an example is
Code:
VecI2 worl= Game.World.worldToArea(Playerpos.xz);
Vec2 worldboxpos=worl*areasize;
if(Inside(player[checkedplayer],Box(transformsfromabove))

if you want you only world areas that actually has terrain, then you could retrieve the area object from worldtoarea, then check if that area actually has objects/terrain before checking if the player is inside. if there is areas that will have terrain but should be accessible you could always add an invisible object type you can place within each area manually, which you can then check through the Game::Area class by looking over the list of objects, then you can check only areas that has this object, if not he is out of bounds.

you can either just run a test on your own client to get the total area yourself by putting the spawn point at the edge of your map. this way you will have the minimum VecI2 positions and the maximum VecI2 to construct one huge box to check for Inside or you can do it per activearea if your world is not rectangular.

Thanks. I guess the best choice would be to get "start" and "end" coordinates manually.
07-14-2019 10:28 PM
Find all posts by this user Quote this message in a reply
Post Reply