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

[Highly Customized] Jumpjet Tilts While Moving #1521

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

CrimRecya
Copy link
Contributor

@CrimRecya CrimRecya commented Feb 11, 2025

  • Now you can make jumpjets tilt forward when moving forward and sideways when turning by setting JumpjetTilt to true.
  • The maximum tilt angle will not exceed 45 degrees.
    • The magnitude of the forward tilt is related to the current speed and acceleration. They are additive and have two coefficients that can be adjusted for details.
    • The magnitude of the sideways tilt is related to the current speed and rotation angle. They are multiplied and also have two coefficients that can be adjusted for details.

In rulesmd.ini:

[AudioVisual]
JumpjetTilt=false                       ; boolean

[SOMEUNIT]                              ; UnitType, with Locomotor=Jumpjet
JumpjetTilt=                            ; boolean, defaults to [AudioVisual]->JumpjetTilt
JumpjetTilt.ForwardAccelFactor=1.0      ; floating point value
JumpjetTilt.ForwardSpeedFactor=1.0      ; floating point value
JumpjetTilt.SidewaysRotationFactor=1.0  ; floating point value
JumpjetTilt.SidewaysSpeedFactor=1.0     ; floating point value

jjtilt

  • In addition, fix an issue caused by Phobos:
    Ground units being lifted will turn to attacker weirdly.

Copy link

github-actions bot commented Feb 11, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Copy link
Member

@Metadorius Metadorius left a comment

Choose a reason for hiding this comment

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

Looks good, few style and readability issues.

I have a few suggestions though:

  1. Ability to control how much the jumpjet tilts, I imagine via separate factors for forward and sideway tilts.
  2. Ability to account acceleration for directional tilt (when accelerating - tilt forwards, decelerating - tilt backwards to decelerate). This could work additionally to movement-dependant tilt.
  3. Debatable: ability to account speed for rotational tilt, because static helicopter rotating via tilt looks weird, and to do sharp turns at high speed you must tilt a lot. But maybe could just remove rotation sideways tilt when not moving.
JumpjetTilt.ForwardAccelFactor  ; FAF 
JumpjetTilt.ForwardSpeedFactor  ; FSF
JumpjetTilt.SidewaysRotationFactor  ; SRF
JumpjetTilt.SidewaysSpeedFactor  ; SSF

Pseudocode to show what I mean:

arf += movement_acceleration * FAF + movement_speed * FSF
ars += rotation_speed * SRF * movement_speed * SSF

(By the way, I am not sure I understand the current sideways rotation logic correctly. What does it depend on?)

What do you think?

docs/New-or-Enhanced-Logics.md Outdated Show resolved Hide resolved
Comment on lines 186 to 196
constexpr auto factor = (Math::HalfPi / 4) / 32;
arf += static_cast<float>(std::min(32.0, pThis->CurrentSpeed) * factor);
}

const auto& locoFace = pThis->LocomotionFacing;

if (locoFace.IsRotating())
{
constexpr auto factor = (Math::HalfPi / 4) / 32768 / 65536;
const auto leftRaw = locoFace.RotationTimer.GetTimeLeft() * locoFace.ROT.Raw;
const auto dirMult = (static_cast<short>(locoFace.Difference().Raw) * leftRaw);
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to have an explanation in a comment about what is the calculation logic. Also magic numbers should be fixed.

src/Ext/TechnoType/Hooks.MatrixOp.cpp Outdated Show resolved Hide resolved
docs/New-or-Enhanced-Logics.md Outdated Show resolved Hide resolved
@Coronia
Copy link
Contributor

Coronia commented Feb 12, 2025

If a tilting jumpjet is affected by EMP, it'll gradually resume to normal stance while being EMP'd. Not sure if it should behave like that

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

Successfully merging this pull request may close these issues.

3 participants