Proposal for a common script function with the following definition.
Code: Select all
<xs:element name="check_vector_intersect_boundingbox">
<xs:annotation>
<xs:documentation>
Returns true if a vector intersects a given bounding box
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="action" />
<xs:attribute name="component" type="object" use="required" />
<xs:attribute name="position_one" type="position" use="required" />
<xs:attribute name="position_two" type="position" use="required" />
<xs:attribute name="result" type="lvaluename" use="required" />
</xs:complexType>
</xs:element>
http://www.3dkingdoms.com/weekly/weekly.php?a=3
Why Is It Proposed?
Allowing to check if a vector intersects a bounding box would make scripts that need to avoid collision a lot easier. For example in the move.flee.boost command instead of taking a bunch of averages to create a point and then creating a vector from it and the ships position, you could just check if the ships current position and boost end point would intersect any obstacles bounding box. If no intersection boost in the current direction, otherwise rotate a little bit randomly and then see if you intersect.
I believe this would allow the Egosoft developers and modding community to do a lot of interesting things when it comes to ship movement in combat.
Alternatives
Exposing bounding boxes fully for everything that inherits from controllable. Bounding boxes could be represented as a set of 8 points with a given rotation if they are not axis aligned.