Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: Goober5000 on December 29, 2020, 11:16:12 pm

Title: Submodel rotation upgrade test builds
Post by: Goober5000 on December 29, 2020, 11:16:12 pm
TLDR: Submodels can now rotate on any axis.  Model code has been optimized; model rendering and collision should now be faster.  This feature, plus m!m's action system feature, will be used for the animation system upgrade after the next official release.


This is a rather substantial rewrite/refactor of the submodel rotation code. Submodel rotation is now tracked via an axis-angle representation, which is used to calculate a matrix to represent the submodel orientation in the model instance. The axis can be any vector, not limited to the standard X, Y, and Z vectors.

The submodel orientation is now used for position calculation in almost every place the submodel angles were previously used. In conjunction with the simplification of KeldorKatarn's code, this saves a significant number of calculations for every movable submodel in every frame. Hopefully this should lead to a measurable speedup in both rendering and collision detection.

To change the rotation axis of a submodel, add the $rotation_axis: property as specified in the wiki (https://wiki.hard-light.net/index.php/Subobject_and_subsystem_properties#.24rotation_axis:).

Test builds can be downloaded here (http://staff.hard-light.net/goober5000/temp/fs2_open_20_1_0_x64_AVX2-rotation_axis.7z).
Title: Re: Submodel rotation upgrade test builds
Post by: wookieejedi on December 30, 2020, 08:54:13 am
This is very exciting. FotG will definitely be taking advantage of this to improve our s-foil rotations.
Title: Re: Submodel rotation upgrade test builds
Post by: Goober5000 on December 30, 2020, 01:20:02 pm
It just occurred to me that this will also make it possible to have turrets on rotating submodels. :pimp:

That is to say, this PR is 99% of the way there.  The only thing needed is a proper field-of-view calculation.