Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Synchronize to note tap and note destruction (with lerp) | Rhythm Game

Discussion in 'Scripting' started by miko_2007, May 10, 2023.

  1. miko_2007


    Sep 3, 2022
    I don't know if I understand myself, I have this code that works quite well, the notes fall precisely to the target but they stop there, what I want to achieve is that the note reached the collider at the correct time but that it keeps going down until it exits the screen and end up destroying the note. Some help?

    Code (CSharp):
    1. void Update() {
    2.         float time = (Conductor.instance.beatsShownInAdvance - (beatOfThisNote - Conductor.instance.songPositionInBeats)) / Conductor.instance.beatsShownInAdvance;
    4.         Vector2 position = Vector2.Lerp(spawnPosition, tapPosition, time);
    5.         transform.position = position;
    6. }