Browse Source

Fixed inertia component dampening

master
Ludovic 'Archivist' Lagouardette 1 month ago
parent
commit
3b52b3f580
3 changed files with 8 additions and 6 deletions
  1. +2
    -2
      Expansion2/InertiaComponent.cs
  2. +2
    -0
      Smoll/Entity.cs
  3. +4
    -4
      Smoll/Transform2D.cs

+ 2
- 2
Expansion2/InertiaComponent.cs View File

@ -39,8 +39,8 @@ namespace Smoll.Ex2 {
ownerTransform.transform.position += transform.position * deltaTimeSeconds;
ownerTransform.transform.angle += transform.angle * deltaTimeSeconds;
transform.position *= dampening;
transform.angle *= dampening;
transform.position *= MathF.Pow(dampening, deltaTimeSeconds);
transform.angle *= MathF.Pow(dampening, deltaTimeSeconds);
}
}

+ 2
- 0
Smoll/Entity.cs View File

@ -41,6 +41,7 @@ namespace Smoll {
parent.actionables.Sort();
}
}
public Entity(Layer parent) {
this.parent = null;
components = new List<Component>();
@ -51,6 +52,7 @@ namespace Smoll {
layers = new List<Layer>();
layers.Add(parent);
}
public void Attach(Component component) {
component.owner = this;
components.Add(component);

+ 4
- 4
Smoll/Transform2D.cs View File

@ -54,10 +54,10 @@ sealed class Transform2DComponent : Component {
} while(true);
}
public override void Update(float _)
{
transform.ForceInvariant();
}
public override void Update(float _)
{
transform.ForceInvariant();
}
}
}

Loading…
Cancel
Save