Skip to content

Commit b7bc8f9

Browse files
committed
Gibs inherit velocity derived from the angular velocity of an MO and their offset from the centre. Scaled by InheritsVel and doesn't affect gibs without offset.
1 parent c9859e9 commit b7bc8f9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8383

8484
- Almost all ctrl+* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right alt, to not interfere with default crouching inputs. The only exception is ctrl+arrow keys for changing console size.
8585

86+
- Gibs now inherit velocity derived from the angular velocity of an MO. This only affects gibs with an offset, and is scaled by `InheritsVel`.
87+
8688
</details>
8789

8890
<details><summary><b>Fixed</b></summary>

Source/Entities/MOSRotating.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,13 @@ void MOSRotating::CreateGibsWhenGibbing(const Vector& impactImpulse, MovableObje
942942
gibParticleClone->SetHFlipped(m_HFlipped);
943943
Vector gibVelocity(radius * scale + minVelocity, 0);
944944
gibVelocity.RadRotate(randAngle + RandomNum(0.0F, spread) + static_cast<float>(i) * goldenAngle);
945+
946+
if (gibSettingsObject.InheritsVelocity() > 0 && !rotatedGibOffset.IsZero()) {
947+
Vector rotationalVelocity = (rotatedGibOffset.GetPerpendicular() * m_AngularVel * gibSettingsObject.InheritsVelocity()) / c_PPM;
948+
gibVelocity += rotationalVelocity;
949+
gibParticleClone->SetAngularVel(gibParticleClone->GetAngularVel() + m_AngularVel * gibSettingsObject.InheritsVelocity());
950+
}
951+
945952
if (lifetime != 0) {
946953
gibParticleClone->SetLifetime(std::max(static_cast<int>(static_cast<float>(lifetime) * (1.0F - lifeVariation * ((radius / maxRadius) * 0.75F + RandomNormalNum() * 0.25F))), 1));
947954
}
@@ -998,7 +1005,15 @@ void MOSRotating::CreateGibsWhenGibbing(const Vector& impactImpulse, MovableObje
9981005
} else {
9991006
gibVelocity.RadRotate(gibSpread * RandomNormalNum());
10001007
}
1008+
1009+
if (gibSettingsObject.InheritsVelocity() > 0 && !rotatedGibOffset.IsZero()) {
1010+
Vector rotationalVelocity = (rotatedGibOffset.GetPerpendicular() * m_AngularVel * gibSettingsObject.InheritsVelocity()) / c_PPM;
1011+
gibVelocity += rotationalVelocity;
1012+
gibParticleClone->SetAngularVel(gibParticleClone->GetAngularVel() + m_AngularVel * gibSettingsObject.InheritsVelocity());
1013+
}
1014+
10011015
gibParticleClone->SetVel(gibVelocity + ((m_PrevVel + m_Vel) / 2) * gibSettingsObject.InheritsVelocity());
1016+
10021017
if (movableObjectToIgnore) {
10031018
gibParticleClone->SetWhichMOToNotHit(movableObjectToIgnore);
10041019
}

0 commit comments

Comments
 (0)