Pin a docked ship to its parent before the inactive return; no flight while docked
Docking deactivates the ship, and Entity.Update returned before the parent pin, so a docked ship kept integrating its own velocity and gravity (Ship.Update) for as long as it sat in the bay, and undocked wherever it had fallen to at whatever speed it had reached. Drag used to bleed that off; with no drag below top speed it flung the ship into the void. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7a3c0c8fb8
commit
f3927e24db
2 changed files with 21 additions and 15 deletions
|
|
@ -1821,6 +1821,13 @@ public abstract class Entity
|
|||
public virtual void Update(float delta)
|
||||
{
|
||||
TurnRate = 0;
|
||||
// A parented entity (a docked ship) sits on its parent, active or not: docking deactivates the ship, so this pin
|
||||
// comes before the inactive return, or the ship keeps whatever pose its own physics last gave it.
|
||||
if (Parent != null)
|
||||
{
|
||||
Position = Parent.Position;
|
||||
Velocity = Parent.Velocity;
|
||||
}
|
||||
if (!_active) return;
|
||||
|
||||
var velocityBefore = Velocity;
|
||||
|
|
@ -1937,12 +1944,7 @@ public abstract class Entity
|
|||
foreach(var child in Children)
|
||||
child.Update(delta);
|
||||
|
||||
if (Parent != null)
|
||||
{
|
||||
Position = Parent.Position;
|
||||
Velocity = Parent.Velocity;
|
||||
}
|
||||
else Position.y = RideHeight(Position.xz);
|
||||
if (Parent == null) Position.y = RideHeight(Position.xz);
|
||||
|
||||
Acceleration = delta > 0f ? (Velocity + LimitClamp - velocityBefore) / delta : float2(0, 0);
|
||||
Manoeuvre.Observe(Acceleration, delta, ItemManager.GameplaySettings.SolutionWindow);
|
||||
|
|
|
|||
Loading…
Reference in a new issue