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
Is there a way to ârestartâ the wind lines instead of calling the module function for it to just stack up the wind lines
This is a great model, however when I use this on my ghibli trees, they just get out of position, and I canât turn my leaves cancollide off since it wont work.
You shouldnât be shaking collidable objects anyway since the physics of moving so many objects like that can lag
Thatâs why Iâm trying to turn cancollide to false but they just fall of the map.