Sign in to follow this  

Portal problem

This topic is 4744 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 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

This topic is 4744 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this