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

[Customized] Customized Vehicle Turret Rotation #1480

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

Conversation

CrimRecya
Copy link
Contributor

  • When ExpandTurretRotation is set to true, the following functions will be enabled.
  • Units with turret without TurretSpins=true can looks more vivid when it is in idle.
    • Turret.IdleRotate controls whether units can rotate their turrets when in idle. Defaults to [AudioVisual] -> Turret.IdleRotate.
    • Turret.PointToMouse controls whether units will turn their turrets to your mouse when in idle. Defaults to [AudioVisual] -> Turret.PointToMouse.
    • Turret.IdleRestartMin and Turret.IdleRestartMax control the delay from idle to action occurrence together.
    • Turret.IdleIntervalMin and Turret.IdleIntervalMax control the delay between every idle actions together.
  • The turret and body of the units can now be rotated under control.
    • Turret.Restriction defines the angle at which the turret can be turned to both sides.
    • Turret.ExtraAngle defines the additional rotation angle of the turret, and Turret.Restriction will also rotate with this value. The positive number is clockwise and the negative number is counterclockwise, that is, what angle the turret should use by default or face the target.
    • Turret.BodyOrientation controls whether the body needs to aim at the target when firing.
    • Turret.BodyOrientationAngle defines the additional rotation angle of the body when aiming at the target. The positive number is clockwise and the negative number is counterclockwise, that is, what angle the body should use to face the target.
    • Turret.BodyOrientationSymmetric controls whether both sides of the additional body rotation angle can be used.

In rulesmd.ini:

[General]
ExpandTurretRotation=no             ; boolean

[AudioVisual]
Turret.IdleRotate=false             ; boolean
Turret.PointToMouse=false           ; boolean
Turret.IdleRestartMin=150           ; integer, number of frames
Turret.IdleRestartMax=300           ; integer, number of frames
Turret.IdleIntervalMin=150          ; integer, number of frames
Turret.IdleIntervalMax=450          ; integer, number of frames

[SOMEUNIT]                          ; VehicleType, `Turret=yes`
Turret.IdleRotate=                  ; boolean
Turret.PointToMouse=                ; boolean
Turret.Restriction=180.0            ; floating point value
Turret.ExtraAngle=0                 ; floating point value
Turret.BodyOrientation=no           ; boolean
Turret.BodyOrientationAngle=0       ; floating point value
Turret.BodyOrientationSymmetric=yes ; boolean

Update for #1308 .

Copy link

github-actions bot commented Dec 28, 2024

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.

@@ -485,6 +507,8 @@ class TechnoTypeExt

static ExtContainer ExtMap;

static constexpr double AngleToRaw = (65536.0 / 360);
Copy link
Member

Choose a reason for hiding this comment

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

I am pretty sure this can be handled with the code @secsome has written for Binary Angle Measurement, see Dir.h and Facing.h in YRpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I may have missed something? I did notice that it can use radian to raw, but I didn't see angle to raw.

Copy link
Member

@Metadorius Metadorius Jan 15, 2025

Choose a reason for hiding this comment

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

Oh, I see where the issue is. I think most angle values parsed from INI are DirType, not degrees, so I would use this here too. See RotationAdjust here for example: https://github.com/Phobos-developers/Phobos/pull/352/files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Get it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked at it, but I thought it might be troublesome.
Because if you use DirType, INIer need to fill in the value of 0-255, which is not very intuitive.
But if you use the angle directly, it is very easy to understand.

Copy link
Member

Choose a reason for hiding this comment

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

There is already such a usage in vanilla game. PoseDir takes DirType. I think it's better to stay consistent in this case. Personally I don't feel much issue with using 0-255 instead od 0-360.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will consider modifying it later.

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.

2 participants