Original Post
🔒 Locked
Portal problem
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?
-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?
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.
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.
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.
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.
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.
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.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement