Skip to content

reimplement look_at#3144

Merged
Goober5000 merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix_look_at
Feb 10, 2021
Merged

reimplement look_at#3144
Goober5000 merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix_look_at

Conversation

@Goober5000

@Goober5000 Goober5000 commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

This PR re-implements the look_at feature, which has been broken for many years. A look-at rotation is a type of intrinsic_rotation, just like dumb-rotations. The same code handles both; the only difference is whether submodel_rotate or submodel_look_at is called to apply the actual movement.

The previous look_at parsing code has been optimized by performing the name-to-submodel resolution when the model is actually parsed, instead of when the first look-at rotation is called. This avoids the need to store a name in the submodel struct and also avoids cluttering the look_at function.

This PR is essentially bookkeeping, except for the submodel_look_at method. This method takes advantage of the submodel rotation upgrade and calculates angles in almost the same way as the new turret rotation code. It's much more elegant, much less hackish, and works for all detail levels.

This PR depends on #3056 and will remain in draft status until that is merged.

@Goober5000 Goober5000 added enhancement A new feature or upgrade of an existing feature to add additional functionality. cleanup A modification or rewrite of code to make it more understandable or easier to maintain. fix A fix for bugs, not-a-bugs, and/or regressions. labels Jan 14, 2021
@Goober5000 Goober5000 added this to the Release 21.2 milestone Jan 14, 2021
@Goober5000 Goober5000 added models Issues or features having to do with model data (like animations or geometry) Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle labels Jan 14, 2021
@Goober5000 Goober5000 added the mantis A feature or issue imported from MANTIS, the old issue tracker label Jan 14, 2021
@Goober5000 Goober5000 removed the Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle label Jan 27, 2021
@Goober5000 Goober5000 marked this pull request as ready for review January 31, 2021 18:20
This PR re-implements the look_at feature, which has been broken for many years.  A look-at rotation is a type of intrinsic_rotation, just like dumb-rotations. The same code handles both; the only difference is whether submodel_rotate or submodel_look_at is called to apply the actual movement.

The previous look_at parsing code has been optimized by performing the name-to-submodel resolution when the model is actually parsed, instead of when the first look-at rotation is called.  This avoids the need to store a name in the submodel struct and also avoids cluttering the look_at function.

This PR is essentially bookkeeping, except for the submodel_look_at method.  This method takes advantage of the submodel rotation upgrade and calculates angles in almost the same way as the new turret rotation code.  It's much more elegant, much less hackish, and works for all detail levels.

@Baezon Baezon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only one very minor comment, that really isn't an issue or anything.

Comment thread code/model/modelread.cpp
@Goober5000 Goober5000 merged commit 3d6124c into scp-fs2open:master Feb 10, 2021
@Goober5000 Goober5000 deleted the fix_look_at branch February 10, 2021 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain. enhancement A new feature or upgrade of an existing feature to add additional functionality. fix A fix for bugs, not-a-bugs, and/or regressions. mantis A feature or issue imported from MANTIS, the old issue tracker models Issues or features having to do with model data (like animations or geometry)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants