Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1121 closed defect (fixed)

Flat actors cause problems with new selection boxes

Reported by: historic_bruno Owned by: vts
Priority: Nice to Have Milestone: Alpha 11
Component: Core engine Keywords:
Cc: vts Patch:

Description

Some actors like props/flora/water_lillies.xml which are not decals but flat models, can cause selection problems in Atlas. They have a selection box, but the calculation of the box and/or the the algorithm in RayIntersect is failing and causing unpredictable behavior. It's especially noticeable on Belgian Bog, due to the high concentration of such lillies in the center. Clicking in a seemingly open area of the map might select a lilly by mistake. Strangely props/flora/pond_lillies_large.xml does not have this problem.

It's easy to test on a blank map. I put a breakpoint in the selection code and found the CBoundingBoxOriented data for water_lillies:

m_Center = {X=298.17743 Y=22.402514 Z=378.40604 }
m_HalfSizes = {X=1.8804212 Y=0.00000000 Z=1.8804319 }
m_Basis
   [0] = {X=0.70711076 Y=0.00000000 Z=0.70710266 }
   [1] = {X=-1.#IND000 Y=-1.#IND000 Z=-1.#IND000 }
   [2] = {X=-0.70709860 Y=0.00000000 Z=0.70711488 }

compared with the data for pond_lillies_large:

m_Center = {X=297.05060 Y=22.391361 Z=382.82440 }
m_HalfSizes = {X=10.045100 Y=9.5367432e-007 Z=9.4280548 }
m_Basis
   [0] = {X=0.70711213 Y=0.00000000 Z=0.70710146 }
   [1] = {X=0.00000000 Y=1.0000000 Z=0.00000000 }
   [2] = {X=-0.70710194 Y=0.00000000 Z=0.70711166 }

Notice the first example has -1.#IND000 values in one of its basis vectors, which means "indeterminate" value. The height of the bounding box (m_HalfSizes.Y) is exactly 0. The second example has sane values. Maybe we could detect completely flat models and give them a small selection box height or specially handle 2D intersection in 3D space. I guess a similar problem would occur with a vertically-oriented flat model, so the best solution is probably independent of orientation.

Change History (4)

comment:1 by vts, 12 years ago

Owner: set to vts
Status: newassigned

comment:2 by vts, 12 years ago

Resolution: fixed
Status: assignedclosed

In 11928:

Fixed AABB to OBB transformation resulting in NaN basis vectors when the AABB size in one or more dimensions is zero. Fixes #1121.

comment:3 by vts, 12 years ago

Milestone: BacklogAlpha 11

comment:4 by vts, 12 years ago

I've examined the ray intersection test more closely, and it is deals with flat boxes correctly. The problem was in the AABB to OBB transformation method that assumed that it could take a vector between any two box corner points along a dimension. That doesn't work if the box size in that dimension is zero, though.

I've replaced it with a different transformation method that transforms the AABB basis vectors directly, bypassing the need to take that vector. I also added some basic tests for the transformation, just to make sure the math is right (and stays right).

Last edited 12 years ago by vts (previous) (diff)
Note: See TracTickets for help on using tickets.