18-09-2020, 07:10 AM
(This post was last modified: 18-09-2020, 11:40 AM by josemendez.)
(18-09-2020, 12:14 AM)Havie Wrote: SO,
I've fixed the flying in the air issue,
it was a combination of having a rigidbody with Gravity and an Obi Collider .
For whatever reason this would enact all sorts of weird force onto the ball,
So ive removed the Collider entirely.
However, I can no longer enact force on this ball.
Prior to adding the OBISoftbody I was moving my ball through the scene with :
_rigidbody.AddForce(direction * BallFireForce, ForceMode.Impulse);
However, this no longer does anything. Probably being prevented from the OBI system.
I tried adding an ObiRigidBody to my script instead, but it does not have a AddForce method?
I went looking for docs on ObiSoftBodies how to move them, and ObiRigidBodies, but all i could find was :
UpdateVelocities(linearDelta, angularDelta)
http://obi.virtualmethodstudio.com/api.html
I have no clue how to use these, it says it gets the velocities back from the solver? Is the Solver keeping track of my base rigidbodies velocity? This doesnt feel right
Thanks
I sense a LOT of confusion here, so I'll try my best to explain.
Mixing rigidbody and softbody components together in the same object doesn't make much sense. This isn't even specific to Obi, but a basic concept in physics: a rigidbody, as the name implies, approximates the dynamics of an object assuming it cannot deform as a result of stress. So, it's a rigid object.
On the other hand, a softbody also approximates the dynamics of an object but does not assume it will be rigid. The object is allowed to deform due to stress, it's a soft object.
So placing both a rigid and a soft body component on a single object serves no purpose whatsoever and doesn't even make sense. It's like saying an object is liquid and solid at the same time, and applying both liquid and solid physics to it. An object is either a softbody or a rigidbody, can't be both at once. (In real life though, all objects are "softbodies" as anything will deform under a high enough amount of stress. The "rigidbody" mathematical model is a huge simplification that works well in many cases, and is used instead because it is much cheaper to calculate compared to most softbody models).
Take a look at the API docs: Softbodies (actually, all actors) have the same AddForce() method that rigidbodies do, as softbodies are basically an "upgrade" from rigidbodies. So you should be able to just do softbody.AddForce() ("softbody" being of type ObiSoftbody). Note that an impulse takes object mass into account -as an impulse is basically an instant force-, so the effect on your softbody depends on how heavy it is. You can control particle mass individually in the blueprint editor.
The ObiRigidbody component is just a wrapper over Unity's rigidbody component, and is used to make rigidbodies "visible" to Obi so that they can interact with softbodies in the scene. It's automatically added when needed so you shouldn't bother. See: http://obi.virtualmethodstudio.com/tutor...sions.html