Releasing softbody particles from anchor - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html) +--- Thread: Releasing softbody particles from anchor (/thread-3820.html) |
Releasing softbody particles from anchor - blobman - 26-03-2023 Following along the script example here: Code: using UnityEngine; What is a good approach to later release the softbody particles from the anchor? I tried saving a copy of `velocities` and `invMasses` prior to setting them to 0, and then restoring them on the actor's solver when some callback gets invoked. This did not seem to work. or is there a way to disable gravity on the exclusively on the softbody particles? RE: Releasing softbody particles from anchor - josemendez - 27-03-2023 (26-03-2023, 11:57 PM)blobman Wrote: What is a good approach to later release the softbody particles from the anchor? Hi! Make sure to call UpdateParticleProperties() on a softbody after modifying its particle properties. This is needed for softbodies only, because the rest shape configuration of the softbody needs to be updated if the mass or position of particles are modified. See the ObiContactGrabber.cs sample script for reference. (26-03-2023, 11:57 PM)blobman Wrote: or is there a way to disable gravity on the exclusively on the softbody particles? You can disable gravity for the entire solver by setting it to zero, and then implement your own gravity by adding a custom acceleration to particles of your choice. (that is, increasing their velocity) let me know if you need further help, RE: Releasing softbody particles from anchor - blobman - 27-03-2023 Thanks for your reply. For now we found a workaround using the Teleport method on the softbody. Will let you know if we try the anchor method again! FYI: I don't think this bug got patched: http://obi.virtualmethodstudio.com/forum/thread-3742-post-13810.html#pid13810 Had to manually patch it in Obi Softbody 6.5.1 Okay. The teleport work around seem work yesterday. However today, I'm running into index out of bounds at a different line: Code: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Code at Assets/Obi/Scripts/Softbody/Actors/ObiSoftbody.cs:198: Code: public override void Teleport(Vector3 position, Quaternion rotation) Tried setting rotation to `Quaternion.identity` or rotation on the model's transform. Update: Teleport method seems to work when I invoke in `Update`, but does not in `Start`. So perhaps there is some softbody initialize at runtime I need to watch out for? Update2: Perhaps the issue is here: Code: public override void LoadBlueprint(ObiSolver solver) Update3: Found the issue. It's due to application not yet playing ... so have to wait until that flag is flipped! |