void Rewind() { if (pointsInTime.Count > 0) { PointsInTime pointInTime = pointsInTime[0]; transform.position = pointInTime.position; audioSong.time = pointInTime.songTime; pointsInTime.RemoveAt(0); } else { StopRewind(); } }
void startRewind() { //rb.isKinematic = true; PointsInTime point = new PointsInTime(); if (points.Count > 1) { point = points.Last.Value; } else { point = points.First.Value; } transform.position = point.pos; transform.rotation = point.rot; velocityBefore = rb.velocity; //rb.velocity = point.velocity; //rb.AddForce(point.velocity, ForceMode.VelocityChange); //velocityAfter = rb.velocity; Vector3 vel = rb.velocity; rb.velocity = vel; velocityAfter = rb.velocity; if (points.Count > 1) { points.RemoveLast(); } else { Debug.Log("Somethign"); } }