# Portal problem

This topic is 5048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm considering a portal engine. But in a portal engine, your must first determine which portal you're in. How to solve that problem?

##### Share on other sites
i think you mean sector
-which sector you are in

with a portal engine you have sectors joined by portals

to start off, you really should know which sector you start in, since when you design your map you have to place a 'spawn point' or something for the player to start at, right?

then you'd just keep track of which one he moves into whenever walking thru a portal

simple enough, or are you asking something else?

##### Share on other sites
I'm not using any player spawn point. How to determine the sector with an arbitary camera point?

##### Share on other sites
Not trying to be rude or anything, but maybe you should start with something more simple? Or at least read some tutorials on the subject. Do a search on goolge, I'm sure there are lots of them.

Find the closest sectors to your object (to narrow it down a bit). Dot the object position with the planes that make up a sector and see if the dot is positive on all planes, if they are, you've found the sector.

I assume the sectors are convex.

##### Share on other sites
I've considered your answer. If there is many sectors, your algorithm will be very slow. I'm considering using a BSP tree to separate the sectors. The dividing planes will be chosen from the portal polygons. But this algorithm only applies to convex sectors. I just want an algorithm for both convex and concave sectors.

##### Share on other sites
The way I would determin if I was in a sector(room, cell, [insert other name of containing object here]) is by doing an aabb(axis alinged bounding box) check as a first pass.

your sectors can genorate these on load, or your could pre-gen them. its a very quick negitive test.

But there is always more than one one way of solving a problem.

Armand.

##### Share on other sites
The AABB approach seems not reliable. As the AABBs of different sectors may overlap.

##### Share on other sites
Quote:
 If there is many sectors, your algorithm will be very slow

That's why I wrote "Find the closest sectors" first. How you find the closest sectors to your point can be done in a number of different ways. quad/oct-tree, bsp, simple sector+radius-to-point-test, ...

The AABB approach Armand mentioned is also to narrow down the number of possible sectors.

Anyway, you only have to find a sector one time. Speed is not really important at that time, right? When you've found it, do as haphazardlynamed said.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 13
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632925
• Total Posts
3009237
• ### Who's Online (See full list)

There are no registered users currently online

×