About SoftBody Moveing - 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: About SoftBody Moveing (/thread-2767.html) |
About SoftBody Moveing - zero16832 - 25-02-2021 Thanks you to make this great plugins! I make a mesh to softbody and use addforce to move the gameobject,it work. But i want to only rotate or move to one axis,how can i to do that? how can i to freeze position or freeze rotation? thank your help! RE: About SoftBody Moveing - josemendez - 25-02-2021 Hi there! Doesn't really make much sense to freeze position/orientation on a softbody, since they don't have a "position" or "orientation". You can't determine the location of a softbody using a rigid transform: what would it mean for a softbody to "be at" <2,3,0>? what if it's stretched, does that change its position? or scale? maybe both? imagine a long, thin rod: if you tie it into a knot, has it rotated? how much? around what axis? These questions only make sense for rigid objects. You can only reason in terms of position/rotation/scale if an object is rigid. In Obi, only individual particles are rigid. For entire softbodies, the closest thing to a "position" you have is the position of their center of mass. You could also use a matrix to express the optimal rotation and scale from the rest shape to the deformed shape, but that's not quite what we normally refer to as rotation/scale. This being said, you can work with individual particles and constrain their linear/angular velocities to lie on a specific plane or axis. See: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html RE: About SoftBody Moveing - zero16832 - 25-02-2021 thx your reply! i know what your mean! but i see a game like that? https://youtu.be/GwfKfqiN1bI in this game the bus only move a way and rotate only on one axis? do you know how to make it ? This problem has been bothering me for several days。 (25-02-2021, 10:02 AM)josemendez Wrote: Hi there! RE: About SoftBody Moveing - josemendez - 25-02-2021 If your meshes are 2D, you could use 2D mode: http://obi.virtualmethodstudio.com/tutorials/obisolver.html Quote:ModeHowever this has two drawbacks: particle orientations will also be restricted to the XY plane, which can look odd if your assets are 3D. Also, it affects the entire solver. If you need "2.5D" (3D assets in a 2D simulation space) you can just project linear velocities to the XY plane, and angular velocities to the Z axis. You can optionally project positions too to avoid drifting. This is very easy to do using the particles API: Code: using UnityEngine; Just add this component to any actor and it will restrict its movement to the solver's local 2D plane. RE: About SoftBody Moveing - zero16832 - 25-02-2021 thx for your help! a new question: when i make a camera follow the softbody,the camera shaking a lot。 Is there any way to avoid this? RE: About SoftBody Moveing - josemendez - 25-02-2021 (25-02-2021, 12:51 PM)zero16832 Wrote: thx for your help! a new question: when i make a camera follow the softbody,the camera shaking a lot。 All physics in Unity take place in FixedUpdate(). FixedUpdate() might not be called at all, or be called more than once per frame, so it's not called in sync with Update or LateUpdate. That will cause the camera movement to jitter. Either smooth out your camera movement (using any of the functions that Unity provides to smooth out movement), or enable interpolation (setting in the ObiSolver component) and subscribe to solver.OnEndStep, then update the camera there. |