Save rotations and shorter frame length

This commit is contained in:
alex-kumpula 2023-11-11 20:46:11 -07:00
parent 35f9476c3d
commit 86b29ec476
3 changed files with 8 additions and 1 deletions

View File

@ -141,7 +141,7 @@ public partial class TAS_System : Node
public override void _Ready()
{
this.FrameLength = 0.1;
this.FrameLength = 1/60;
this.StartIncrementingFrames();
}

View File

@ -14,6 +14,7 @@ public partial class TASable : Node
// Frame data
public Dictionary<int, Vector3> framePositions = new Dictionary<int, Vector3>();
public Dictionary<int, Vector3> frameRotations = new Dictionary<int, Vector3>();
public Dictionary<int, Vector3> frameLinearVelocities = new Dictionary<int, Vector3>();
public Dictionary<int, Vector3> frameAngularVelocities = new Dictionary<int, Vector3>();
@ -21,6 +22,7 @@ public partial class TASable : Node
public virtual void SaveState(int frame)
{
this.framePositions[frame] = this.AssignedRigidBody3D.Position;
this.frameRotations[frame] = this.AssignedRigidBody3D.Rotation;
this.frameLinearVelocities[frame] = this.AssignedRigidBody3D.LinearVelocity;
this.frameAngularVelocities[frame] = this.AssignedRigidBody3D.AngularVelocity;
}
@ -28,6 +30,7 @@ public partial class TASable : Node
public virtual void LoadState(int frame)
{
this.AssignedRigidBody3D.Position = this.framePositions[frame];
this.AssignedRigidBody3D.Rotation = this.frameRotations[frame];
this.AssignedRigidBody3D.LinearVelocity = this.frameLinearVelocities[frame];
this.AssignedRigidBody3D.AngularVelocity = this.frameAngularVelocities[frame];
}

View File

@ -24,4 +24,8 @@ public partial class AdvanceButton : Button
this.Disabled = false;
}
}
}