fix: Transform Local Fields Being Miscalculated
This commit is contained in:
parent
9f522bdb66
commit
8eb34a0a6d
|
@ -52,7 +52,7 @@ public class Transform : ITransform
|
|||
|
||||
public Vector2D Scale
|
||||
{
|
||||
get => _scale;
|
||||
get => _localScale.Scale(Parent?.Scale ?? Vector2D.One);
|
||||
set
|
||||
{
|
||||
if (value == _scale)
|
||||
|
@ -66,7 +66,7 @@ public class Transform : ITransform
|
|||
|
||||
public float Rotation
|
||||
{
|
||||
get => _rotation;
|
||||
get => _localRotation * (Parent?.Rotation ?? 1f);
|
||||
set
|
||||
{
|
||||
if (value == _rotation)
|
||||
|
@ -239,9 +239,9 @@ public class Transform : ITransform
|
|||
private void UpdatePosition()
|
||||
{
|
||||
if (Parent is null)
|
||||
_position = LocalPosition.Scale(Vector2D.One).Rotate(0f * Math.DegreeToRadian);
|
||||
_position = LocalPosition.Rotate(0f * Math.DegreeToRadian);
|
||||
else
|
||||
_position = Parent.Position + LocalPosition.Scale(new(1f / Parent.Scale.X, 1f / Parent.Scale.Y)).Rotate(Parent.Rotation * Math.DegreeToRadian);
|
||||
_position = Parent.Position + LocalPosition.Scale(new(Parent.Scale.X, Parent.Scale.Y)).Rotate(Parent.Rotation * Math.DegreeToRadian);
|
||||
}
|
||||
|
||||
private void UpdateScale()
|
||||
|
|
Loading…
Reference in New Issue