Is there a way to anchor the shaking to the bottom of the part that is shaking? Such as if I have a tree that is all 1 mesh, and i want it to be anchored from the bottom so it doesn’t look like the whole tree is just wobbling from the center… even the bottom moving out of place like some possessed thing. Hahaha. Is there a setting i can set? Or do i have to add one in there?
This would greatly help me (and tons of other developers) as well. I’m not even sure where I’d start if I tried to attempt to script this myself.
This would help anything that’s in the ground (trees, plants, bushes) look more realistic.
Good request, opened an issue regarding this idea.
Let me rephrase… i mean, there is no way to manually add this into the module? I have an idea of what i might do to try it out, what you could do, (And i may attempt this on my own), is add a paramater for pivot offset in when you create a new shake instance. If it isn’t nil, then it will follow that pivot offset. Even maybe have presets for bottom, left, right, top etc.
I have added a simple function to fix this for me. Will be pinning soon. @boatbomber with your permission of course.
Update: Pivot Points
Suggested by @Maximum_ADHD and @Manelin
Roblox recently added a new feature, Pivot Points. You can read about it here:
I’ve updated WindShake to support the new BasePart.PivotOffset
property. You can set any arbitrary pivot point for your part, and WindShake will rotate the part from your defined pivot point.
Prior to this update, all shaking was done from the center of the objects volume. This looked decent in most cases, but could feel rather “floaty” in cases where you’d expect the object to shake from a pivot point near the base- like a leaf shaking from its stem or dangling moss shaking from its base. This feature allows you to make your foliage seem more grounded and rotate from a realistic point.
Update: Rotation Improvement
Previously, objects only rotated in a single direction- they waved back and forth along this plane. This update fixes that by seeding each axis differently in order to give them individual motions for more flowing motion.
Here’s a demonstration of these two features. See how the trunk now rotates from the base, instead of the center? How the objects rotate on all axis, instead of just wiggling back and forth diagonally?
Looks much better.
Update: Performance Improvements!
This module was initially extremely performant, handling tens of thousands of objects at 400+ FPS. However, as more features were added over time, performance took a noticeable hit. There were some users who used older versions of WindShake due to performance implications.
Prior to this performance update, my machine ran a stress test at ~140 FPS. After these performance improvements, it ran at ~230 FPS.
I started by optimizing the calculations, removing metatable usage and minimizing attribute calls. Then @pobammer helped with a more optimized version of the octree module.
Those changes did help squeeze out some more milliseconds, as shown in this stacked bar chart.
I still felt it wasn’t enough. Once the computation was as efficient as it could reasonably be, I then reduced the amount of times that work is done. WindShake would calculate the object targets at 30Hz, and visually set the objects every single frame with linear interpolation. Setting every frame was simply unneeded work. Having leaves update at 150Hz is wasteful and lowers the performance for no real gain. So I added a limiter on the visual setter, and that was enough to boost performance back up to an acceptable level (230FPS). Visuals update at 45Hz by default, but can be configured within the module.
All in all, these changes really boost the performance (especially in cases with tons of objects) and I recommend updating to this latest version!
Hey, can you help me? I can’t get it to work. I tried both on the server and on the client. Basically I tagged all the leaves by adding an attribute into them and then:
for _, Leaf in ipairs(workspace.Map:GetDescendants()) do
if Leaf:IsA("BasePart") and Leaf:GetAttribute("WindShake") == true then
WindShake:AddObjectShake(Leaf); -- I tried printing the parts' names and they printed so the way I tagged with attributes isn't the problem
end;
end;
WindShake:Init();
But they aren’t working for some reason. Do they have to be unanchored? Also can it be used on the client? Thanks in advance.
Try using :Init() before the ipairs iteration part.
Damn, it was that easy. Thanks dawg, it works perfectly fine now.
Now you just gotta make the leaves move with the top of the top of the trunk!
Hey man. I wonder why you hard-coded the range value?
It’s a pretty important variable. I was looking for it since I have a big scene.
Because it’s a footgun and I didn’t want people to alter it without knowing what they’re doing. A bigger range mean performance drops, and it’s not linear- it drops down fast.
You can change it if you like, something like this:
Search(cameraCF.Position + (cameraCF.LookVector * (Range-5)), Range)
Quick question though ive been using this plugin and ive noticed that it doesnt have the little wind effects how can i add that?
Details about the lines was already stated in the post.
Opps sorry! I should have read the full post
If I lower these, will it help at all with any sort of lag?
Yes, although it will make the leaf motion seem choppier.
I used the model plugin of this, and it is working well and smoothly in the studio. However, in the game itself, the parts tagged into the WindShake are moving very poorly, they move in a choppy way. I made sure it wasn’t in my connection or my device. I also changed the Hz lower and above, but it still works very poorly. Here is the game to check out the performance yourself: MODEL TESTING - Roblox
UPDATE: IT works much better now! I applied the code into a LocalScript, and it works as expected now. Much more smooth and not choppy. Would totally recommend!
you could disable the wind streak feature if you can detect if youre indoors