#Seeking playback position in Editor Timeline

1 messages · Page 1 of 1 (latest)

mossy rivet
#

Hello y'all, I'm making an editor for my game, and I need the player to be able to skip to a certain time in the song by clicking somewhere on the timeline, which is contained inside a scrollrect, and all of the lines are the length of the song (length in seconds * speed of lineRunner)

#

Since it's a scrollbar, it's just harder so for this I tried using this script
It basically (tries to) calculate the current place we are in the timeline, by finding where it starts and ends on the screen.
It then finds where between the bounds the mouse is, and uses that to calculate where to put the LineRunner on the grid

#

Of course there's a few problems with this though.
For one...

  • It somehow like, becomes way way less accurate the more of the song you play/deeper to the right of the timeline you go, resulting in the LineRunner being further forward than ideally needed
  • sometimes StartBounds is just plain incorrect

But I'm not good enough at math to see what's wrong. Can someone help?

tired glade
#

[]cb

terse lilyBOT
#

Use codeblocks to send code in a message!

To make a codeblock, surround your code with ```
To use C# syntax highlighting add cs after the three back ticks.

For example:
```cs
Console.WriteLine("Hello World");
```

Produces:

Console.WriteLine("Hello World");

To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.