Jump to content
  • Advertisement
Sign in to follow this  
N64Marin

Portal problem

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

Anyway, to try and answer your question.
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!