Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#295 closed defect (fixed)

Picking units doesn't work as expected due to incorrect bounding box

Reported by: Jan Wassenberg Owned by:
Priority: Must Have Milestone: Alpha 8
Component: Core engine Keywords:
Cc: Patch:

Description

Problem: 'picking' (selecting via cursor) units doesn't work as expected because the bounding box is calculated from the primary geometry of the entity and doesn't include props. Example: celt trader; clicking on either horse or rider should select the unit but currently doesn't.

(Jason's brief explanation of actor and props:) The way most of our actors in the game works is... there is geometry and there are various 'nodes' that are throughout the model - they can be parented to a bone, or in the cases of most static meshes - parented to the 0,0,0 coordinate. These nodes have a name and in the actor xml file it says.. associate this prop point (node) to display this actor (then it points to another actor) Example: <prop actor="props/units/heads/rome_monte_a.xml" attachpoint="helmet"/> The prop actor also has a model; for example.. within that prop actor it defines: <mesh>props/helmet/rome_helmet_d.pmd</mesh>

To solve this, I'd first recommend using Atlas to create an otherwise empty map with a celt trader to serve as a test. The picking/selection code itself is ok, what we need to do is change the bounding box to include props and then the selection will be as desired.

"props" are in turn actors containing a CModel, which again can have props. In this case (trader) I think the rider is a prop.

CModel has a CalcBounds which constructs bounds from all model vertices (possibly also looping over the animation). What we need to do is also recurse over m_Props and expand the parent's bounds to that of the child prop. these "bounds" (m_ObjectBounds) are CBound objects, which are expanded via operator+= (allowing both bounds or a vector as argument). suggestion for what to do: 1) make CalcObjectBounds and CalcAnimatedObjectBound take a parameter of the bounding box to calculate (or expand.. in that case, no longer do SetEmpty there) 2) CalcBounds (the master function that dispatches to one of the above impl functions) must be recursive, expanding the bounds for each prop's bound (m_Props[i].m_Model->ObjectBounds)

Change History (6)

comment:1 by Brandon, 15 years ago

Owner: set to Brandon

comment:2 by (none), 14 years ago

Milestone: Alpha

Milestone Alpha deleted

comment:3 by Andrew, 14 years ago

Milestone: Backlog
Owner: changed from Brandon to Andrew

comment:4 by historic_bruno, 13 years ago

Owner: Andrew removed

comment:5 by vts, 12 years ago

Resolution: fixed
Status: newclosed

(In [10593]) Better selection boxes. Closes #914, #295, #810.

comment:6 by Kieran P, 12 years ago

Milestone: BacklogAlpha 8
Priority: Nice to HaveMust Have
Note: See TracTickets for help on using tickets.