`bs.spline`: A linear function
🧰 Request Type
Feature
🧩 Feature or Module Name
bs.spline
📝 Description
I know that the initial goal of bs.spline is to make smooth curves, but I'd really like a function like #bs.spline:sample_linear.
The reason is that I'm trying to create smooth cinematic movements. What I've achieved works very well with position but I'm having problems when I try to do the same trick for rotation
https://github.com/user-attachments/assets/fa7668a3-94c0-4096-a734-563836e1f49f
We can see screen shakes in the video, The reason is that I'm using a teleport_duration set to 1 and I think the interpolation of this is linear. When having this value set to 0 it's does not shake but looks like a Powerpoint presentation (20 tps). That's why I would like a #bs.spline:sample_linear function.
This may or may not solve my problem, but it would be a nice feature to have along with smooth curves for other module functions.
Looking back at the video, frame by frame, it looks like the Rotation is not updated every tick but every 3 to 20 ticks. That may be a lack of precision in the results?
Okay, I understand now the problem.
https://github.com/user-attachments/assets/963bb792-a1b7-4b8a-83d4-240a4e595cc5
The server only send significant changes in rotation to the client (more than 1.4°): https://www.spigotmc.org/threads/update-entitys-yaw-pitch-each-tick.331592/?utm_source=chatgpt.com
That’s actually a great idea! I was initially focused on smooth curves, but technically, linear splines are still splines, so it absolutely makes sense to include them in the spline module, even if we don’t always think of them that way.
Also, it’s really nice to see you using the module like this. We’re actually planning a camera module next, specifically to make this kind of setup even easier.
And about the server... just use Fabric 😅
I'm using a fabric server 💀 The reason for the bug is that the game does not send the new rotation to the client if it's not significant, because the angle are compared on one byte.
Minecraft encodes yam/pitch into a single byte Angle, where:
byte angle = (byte)(rawDegrees * 256f / 360f)
Any change < 360/256 (about 1.40625 degrees) will truncate to zero, and as there is no difference the rotation packet is not sent to the client.
Ah, sorry, I didn’t look into it too much at first. Since it was a Spigot link, I just assumed it was Spigot-related. But after checking the Minecraft Protocol spec, it looks like there’s not much that can be done... I think the best workaround might be to use larger time steps, like running every 5 ticks instead of every tick, and increasing the teleport_duration to match (basically just lerping between each point). This way, you should almost get the same result, and it should even be more performant.
Oh right, nice idea, I'm gonna try it
I think the best workaround might be to use larger time steps, like running every 5 ticks instead of every tick, and increasing the
teleport_durationto match (basically just lerping between each point). This way, you should almost get the same result, and it should even be more performant.
I tried with 0, 1, 5, and 20 and here are the results:
https://github.com/user-attachments/assets/9f5501de-2dab-4c35-90c1-53005e1397e4
5 looks like the best in my opinion, I also tried 4, 6, and 10 but 5 is really better.