Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct offset for ship spawned aircraft #752

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maxrwalker
Copy link

@maxrwalker maxrwalker commented Nov 16, 2020

Rotated the offset vector of the child (plane) by the facing of the parent (ship) Closes #719

@maxrwalker maxrwalker changed the title Correct offset for ship spawned aircraft #719 Correct offset for ship spawned aircraft Nov 16, 2020
@maxrwalker
Copy link
Author

BTW - I saw the comment about the Exit trait needing modification - but I think this works?

var spawnOffset = exit == null ? WVec.Zero : exit.Info.SpawnOffset;
var spawnOffset = WVec.Zero;
if (exit != null)
spawnOffset = exit.Info.SpawnOffset.Rotate(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(64 - facing.Facing)));
Copy link
Author

Choose a reason for hiding this comment

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

I could move this to the Exit trait as that appears to maintain the facing?

Copy link
Member

Choose a reason for hiding this comment

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

I think that would indeed be better. Where is the magic 64 - coming from?

Copy link
Member

Choose a reason for hiding this comment

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

I can confirm that this also works in a 2D plane with only sprites. Just had to change offset from -250 to 250 so the minus sign may be "wrong" compared to Armament LocalOffset from a regular bullet.

@phrohdoh
Copy link
Member

phrohdoh commented Jan 2, 2021

@maxrwalker would you please address abcdefg30's comment so that we can move forward with this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong exit offsets on Aircraft Carrier and Destroyer
4 participants