reimplement look_at#3144
Merged
Merged
Conversation
24c51a2 to
a76ecdf
Compare
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.
a76ecdf to
72d2f9f
Compare
Baezon
approved these changes
Feb 10, 2021
Baezon
left a comment
Member
There was a problem hiding this comment.
LGTM, only one very minor comment, that really isn't an issue or anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.