Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Game.Server/BaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2261,9 +2261,29 @@ public void SetBlocksLOS(bool blocksLOS) {
public ref readonly Vector3 GetLocalVelocity() => ref Velocity;

public ref readonly Vector3 GetAbsVelocity() {
if (IsEFlagSet(EFL.DirtyAbsVelocity))
CalcAbsoluteVelocity();

return ref AbsVelocity;
}

public void CalcAbsoluteVelocity() {
if (!IsEFlagSet(EFL.DirtyAbsVelocity))
return;

RemoveEFlags(EFL.DirtyAbsVelocity);

BaseEntity? moveParent = GetMoveParent();
if (moveParent == null) {
AbsVelocity = Velocity;
return;
}

MathLib.VectorRotate(Velocity, moveParent.EntityToWorldTransform(), out AbsVelocity);

AbsVelocity += moveParent.GetAbsVelocity();
}

public string? Classname; // prev m_iClassname
public string? GlobalName; // prev m_iGlobalname
public string? ParentName; // prev m_iParent
Expand Down
Loading