Merge branch 'master' of https://git.sjkillen.ca/sjkillen/hurrmmm
This commit is contained in:
commit
015660c7bd
|
@ -12,18 +12,24 @@ public partial class TASable : Node
|
||||||
get { return this._assignedRigidBody3D; }
|
get { return this._assignedRigidBody3D; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Frame data
|
||||||
public Dictionary<int, Vector3> framePositions = new Dictionary<int, Vector3>();
|
public Dictionary<int, Vector3> framePositions = new Dictionary<int, Vector3>();
|
||||||
|
public Dictionary<int, Vector3> frameLinearVelocities = new Dictionary<int, Vector3>();
|
||||||
|
public Dictionary<int, Vector3> frameAngularVelocities = new Dictionary<int, Vector3>();
|
||||||
|
|
||||||
|
|
||||||
public virtual void SaveState(int frame)
|
public virtual void SaveState(int frame)
|
||||||
{
|
{
|
||||||
this.framePositions[frame] = this.AssignedRigidBody3D.Position;
|
this.framePositions[frame] = this.AssignedRigidBody3D.Position;
|
||||||
|
this.frameLinearVelocities[frame] = this.AssignedRigidBody3D.LinearVelocity;
|
||||||
|
this.frameAngularVelocities[frame] = this.AssignedRigidBody3D.AngularVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void LoadState(int frame)
|
public virtual void LoadState(int frame)
|
||||||
{
|
{
|
||||||
this.AssignedRigidBody3D.Position = this.framePositions[frame];
|
this.AssignedRigidBody3D.Position = this.framePositions[frame];
|
||||||
|
this.AssignedRigidBody3D.LinearVelocity = this.frameLinearVelocities[frame];
|
||||||
|
this.AssignedRigidBody3D.AngularVelocity = this.frameAngularVelocities[frame];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +42,7 @@ public partial class TASable : Node
|
||||||
TAS.FramesRegressed += this.OnFramesRegressed;
|
TAS.FramesRegressed += this.OnFramesRegressed;
|
||||||
TAS.StartedIncrementing += this.OnStartedIncrementing;
|
TAS.StartedIncrementing += this.OnStartedIncrementing;
|
||||||
TAS.StoppedIncrementing += this.OnStoppedIncrementing;
|
TAS.StoppedIncrementing += this.OnStoppedIncrementing;
|
||||||
|
TAS.FramesReset += this.OnFramesReset;
|
||||||
|
|
||||||
this.SaveState(0);
|
this.SaveState(0);
|
||||||
}
|
}
|
||||||
|
@ -67,4 +74,9 @@ public partial class TASable : Node
|
||||||
{
|
{
|
||||||
this.AssignedRigidBody3D.Freeze = true;
|
this.AssignedRigidBody3D.Freeze = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnFramesReset()
|
||||||
|
{
|
||||||
|
this.SaveState(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue