-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
recoil force #1218
base: develop
Are you sure you want to change the base?
recoil force #1218
Conversation
This comment was marked as spam.
This comment was marked as spam.
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. |
53a3d53
to
c2635cb
Compare
RecoilForce= works. I assume it's a value between 0 to 1, since anything above 1 doesn't seem to give any effect (1, 50 and 500 had the same result). |
Hmm, no, nevermind, higher values do work. It's more noticeable the higher unit's weight is. Well, forced flipping wasn't the intention of this feature, so i'll end saying that, for what RecoilForce is meant for, it seems to work fine. |
I've been testing the jumpjet facing fix for a while now, and this time, i found no issues. Also not sure what the changes around OmniFire=yes are supposed to be, but i found no problems with it either. I only have a question regarding this line in the documentation: "Jumpjets are recommended to have the same value of body ROT and JumpjetTurnRate". Is it necessary? Jumpjets seem to use JumpjetTurnRate instead of ROT for everything now if when they are inair, so ROT value doesn't really matter anymore. |
I admit that my math model is a bit simplified in this case. There might be a few oversights. I assumed that the impulse was on the XY plane and inverse to the direction of the turret angle, thus I did a simple orthogonal decomposition and calculated the angular momentum separately. As for the rotation, it is assumed that the rotation axes are the front/back-bottom and sideways-bottom, the body is clamped to these axes. According to Newton's second law, the moment is the angular acceleration times the moment of inertia, and the moment of inertia is quadratically proportional to the distance to the axis.
Before Ares introduced TurretROT, the turret's turn rate was just ROT. Jumpjet locomotor has its own facing independent of the unit's facing, and this facing's ROT is JumpjetTurnRate, it was a bad design. When a jumpjet turns it's this facing turns and the body facing synchronizes with it constantly. The glitching you had in #1216 was because I accidentally let the jumpjet facing and the body facing turn at the same time when firing with non-omnifire weapon, and if the body ROT is not the same as JumpjetTurnRate, the body's facing sometimes turns with ROT, sometimes syncs with the jumpjet facing. Even though I should have fixed it, to be safe I would say just let the body ROT the same as JumpjetTurnRate and as for the turret just use Ares' TurretROT |
41450ae
to
b37ce5c
Compare
Got a seemingly random crash in the 2nd build (not this newest one). Didn't get it before, and can't get it again. EIP is 00000000 so don't even know if it's in YR range or outside. |
Newest build, and i'm not sure removing weight was a good idea. It seems extremely difficult now to make voxels recoil only a little bit, and I don't really see any difference between RecoilForce 1 and 500 no matter which unit i test, |
b37ce5c
to
688eb23
Compare
The weight was merely a multiplier, therefore I removed it. The value for the force is a floating number, and it was even usually not bigger than 0.1. Now I take the voxel size into account, and used a new model for the moment of inertia, now firing 45 deg to the front would not tilt the most anymore, and you could scale the value up a bit. I haven't tested a big number like 500, theoretically such a large angular velocity would tilt the unit to death |
@Fryone It should depend on voxel size, but yeah the order of magnitude is around that range. |
Tested on grizzly and on robot tank. Works fine. |
@Fryone no it's my current physics law imposed on this logic. Do you think it should be the inverse? I mean given the same force, firing forward should tilt more than firing sideways for a voxel that has longer dimension on forward direction? |
Overall physics and logics is 100% good. |
I think it should be the game's rounding error when processing falling back from tilting in this case |
RecoilForce scaling is much better now.
I couldn't reproduce such behavior myself. Does that voxel have a barrel separate from the turret? Unit having a turret does affect tilting, so maybe separate barrels will also affect it in some way.
That was my intent testing such high numbers. That's also why i specifically mention that there seems to be a cap on how much a unit can tilt per each shot, because even such numbers do not make it flip instantly. One needs multiple shots in very rapid succession to completely flip a unit (and you don't need high RecoilForce= value to achieve that). |
What happened? Why was this closed? I thought it was completed and just needed to be merged. |
|
For me personally, the feature felt done and ready, so i don't see the need to change anything. Whatever calculations are there, just keep them as they are.
I don't know how it works from inside, so i don't know what's the issue. Can't just apply recoil force from the AlternateFireFLH coord of the weapon being fired? Does OpenTopped logic need some special handling here? |
src/Ext/Unit/Hooks.Jumpjet.cpp
Outdated
if (jjLoco->State == JumpjetLocomotionClass::State::Grounded) | ||
pThis->PrimaryFacing.SetDesired(tgtDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (jjLoco->State == JumpjetLocomotionClass::State::Grounded) | |
pThis->PrimaryFacing.SetDesired(tgtDir); | |
if (jjLoco->State == JumpjetLocomotionClass::State::Grounded) | |
pThis->PrimaryFacing.SetDesired(tgtDir); | |
@@ -259,6 +259,7 @@ This page lists all the individual contributions to the project by their author. | |||
- Allow to tilt regardless of TiltCrashJumpjet | |||
- Forbid firing when crashing | |||
- OmniFire.TurnToTarget | |||
- RecoilForce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- RecoilForce | |
- Voxel unit weapon recoil force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the consensus was to simplify the logic behind this and tie the stuff onto Weight
, and in general be inline with how Rocker
warheads work.
For the 6th time
@mevitar would you plz test if this works under all cases?
What's new:
TiltCrashJumpjet=no
units will correctly tilt in air. Since previously there's no chance for jumpjets to tilt in air so I added a small new feature to test it out:Recoil force
In
rulesmd.ini
: