I wanted a script to easily add vibrations to a set of points that could be generated by @Lucifie’s AddPoints or wave generating scripts.
The script takes an amplitude input, so between the amplitude and point frequency you are using you should be able to really fine tune the speed of your vibrations. (I’ve just realised I’m incorrectly using the word amplitude, what you input is actual 2x the amplitude. Half of the number you input gets added/removed from your points to generate the vibration)
It works by simply adding position to every second point, and subtracting position from every other point, which is a simple way of generating a vibration.
The script is a little rough around the edges, specifically the start and end of the selection, but when you’re dealing with rapid vibrations you won’t likely notice a stray point here or there.
My use case for this script is for generating smooth vibrations (does the idea of "smooth vibrations even make sense? lol) that can follow a pattern.
Hope this is helpful for someone out there! Any feedback is appreciated and I’m happy to answer questions about it, and if you take and modify this I’d appreciate a credit/mention in your post
Good question! I can’t look at it today but from a quick look at the release notes for 2.0.0 it sounds like the API has been updated, so it may break all such extensions. I’ll install the new version soon and play around tomorrow probably!
Yes two things were removed.
The old extension API and the even older “Custom functions” API (which you’re using in this case) was completely removed.
Sorry for the confusion.
The extension API has a little overhead when creating small functions like this but it’s worth it because once you have you can always extend it further.
The code should work with little modification as an extension you just have to wrap it in a binding.
@gagax123 Thanks for the explanation, I think I will update my post just so that it works standalone but if you want to include my code in your extension feel free to add it in
@pallokala2 I’ll make an update to the main post to support OFS 2.0 after I finish work in about 5hrs or so hopefully
Is going to save me a bunch of time. Currently doing my first script and saved me doing vibrations frame by frame. Legend. one thing I wish though would be for the vibrations not to be cumulative but I don’t know if that’s possible. Once again, thank you.
Hey @FootFanatic514 I’m happy to update the extension or provide a modified version, but I’m not sure exactly what you mean by “not be cumulative”, could you elaborate? Maybe with some screenshots of what you mean?
To make it rely less on other scripts, you could decide to also enable a way in which it will add points based on a time duration? Having to manualy make the motion, or use a diffirent script for every single action can still be quite a lot of work (or have other issues).
By adding the missing points, you can still have some gaps near the next normal point (either the gap is too short or too long), but this can already be acceptable in most cases. And otherwise you could just decide to snap that point (moving it slightly forward or backward).
I have no idea how difficult that will be code wise. But it can aid into making longer sections a vibration with less effort.
On that, it can happen that vibrations will exceed a certain speed limit. For that i do have an idea on how it could be countered (again, no idea how the scripts go). But in this case it checks if the action will exceed the set treshold (for the handy speeds above 600 units can give issues), if so, it simply will simply cap its point in such way that speed is reached. If the next spot then is going to be very close in position (because this one isnt limited), it will obviously get a very low speed, but as it doesnt exceed limits, it should not cause issues in which the devide movement becomes disrupted by clipping speeds or ignoring positions. With it, during fast movements this ‘wait’ rather than the inverted motion will still do the job for giving a vibration feeling.
I appreciate the feedback on the extension. In terms of your suggestions re. combining with other point generating scripts and not exceeding speed limits;
I personally prefer keeping such functionality clearly split up. If I add in point generating code into my extension, then that might stifle other uses of vibrations if the two are tied together. I think keyboard shortcuts or other limitations to the point generation scripts may be your limiting factor here. At best if I added this in, I would simply be copy-pasting other people’s extensions into mine and adding a toggle to enable them, which wouldn’t be much better than just using one extension before using mine.
I have had a bit of a think about the speed limit issue but I don’t think I’m up to the task of such a change, in principle it sounds somewhat simple, but I’m not overly familiar with the extension framework. When I was creating what we have here, I didn’t find it particularly easy to inspect properties of the points and then manipulate them.
Sorry to shut down both your suggestions in one fell swoop, I do highly encourage you to dive in and make an updated version of my extension if you’d like.
Took me a bit of hassle, but i seem to have a working version now that includes some of my ideas
This now walks through all nodes and adds in frames based on the frequency you set (defaults at 25, but can be any value you want, although too high values might not work on all devides, and it doesnt compensate for amplitude).
The resulting speeds can get excessive if both numbers are too high. For reference, amplitude * frequency is the average units per second it tries to aim for. (but its not accurate at it, 10 amp and 40 framerate means movements averaging at 400 units per second when the line is flat, but in movement it can exceed that)
For misaligned midpoints it shifts them slightly back (this includes the endpoint). For nodes too close to each other it doesnt act.
(i have not added my credits to the script btw as i was still going to look if i can get it to include a speed limiter, and also, the code for injecting points was handcrafted, i dont know if a more optimal method exists as i just used the OFS docs and my own knowledge of lua for it)
I have actualy been able to get the limiter to work as well, and also added the capability to turn off the features using checkboxes:
I dont know if you prefer that i upload it here in this thread, or make a new one for it (as the base of the code is still yours, my code is just injected at certain parts). If i should make it into a new thread, you will obviously be credited for that with a link to this thread (and ofcourse, your credits are in the code as original designer).
I also fixed some bugs on the script i posted earlier which contained a basic feature of the following:
And yes, you can apply this to an entire script at once (although, you might run into some limits, but i have tested this with a script of 10mins without issues).